We have moved our domain from sapnuts.com to zapnuts.com, please bookmark and share.

Using Package Size in Select Statements in SAP ABAP

Author | Last Updated| | 121 Comments Facebook Share Twitter Share Google Plus Share A+ A-


Using package size in SAP ABAP Select statements to increase the performance of a ABAP program

Step1:What is package size in SAP ABAP? Important Top^

Package size is used to process limited set of records at a time to avoid overloading of memory, this technique will increase performance of a program at a greater level.

Syntax for using Package size in select statements

SELECT <FIELD LIST> FROM <DB TABLE> INTO TABLE <INTERNAL TABLE> PACKAGE SIZE <SIZE>
<WHERE CONDITION> .
  IF SY-SUBRC = 0.
**Process records (add logic)
 ENDIF.
ENDSELECT.

By using package size we process set of records at a time between SELECT and ENDSELECT, we have to add our business logic between SELECT and ENDSELECT....see the example use of package size in next step.

Step2:Example of using Package Size in SAP ABAP Normal Top^

The below is the example of using PACKAGE SIZE in SAP ABAP programs using SELECT and ENDSELECT.

In the below example we are getting data from MARA based on a package and downloading the data into an excel sheet.
REPORT ZSAPN_PACKAGE.
DATA : IT_MARA TYPE TABLE OF MARA.
DATA : IT_MARA1 TYPE TABLE OF MARA.
DATA : WA_MARA TYPE MARA.

PARAMETERS P_MTART TYPE MARA-MTART.

SELECT * FROM MARA INTO TABLE IT_MARA PACKAGE SIZE 100 UP TO 1000 ROWS
  WHERE MTART = P_MTART .
  IF SY-SUBRC = 0.
    APPEND LINES OF IT_MARA TO IT_MARA1. "append data to another internal table
  ENDIF.
ENDSELECT.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                    =
    FILENAME = 'C:\MARA.XLS'
    FILETYPE = 'ASC'
*   APPEND   = ' '
*   WRITE_FIELD_SEPARATOR           = ' '
*   HEADER   = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
*   WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
*   SHOW_TRANSFER_STATUS            = ABAP_TRUE
*   VIRUS_SCAN_PROFILE              = '/SCET/GUI_DOWNLOAD'
* IMPORTING
*   FILELENGTH                      =
  TABLES
    DATA_TAB = IT_MARA1
*   FIELDNAMES                      =
* EXCEPTIONS
*   FILE_WRITE_ERROR                = 1
*   NO_BATCH = 2
*   GUI_REFUSE_FILETRANSFER         = 3
*   INVALID_TYPE                    = 4
*   NO_AUTHORITY                    = 5
*   UNKNOWN_ERROR                   = 6
*   HEADER_NOT_ALLOWED              = 7
*   SEPARATOR_NOT_ALLOWED           = 8
*   FILESIZE_NOT_ALLOWED            = 9
*   HEADER_TOO_LONG                 = 10
*   DP_ERROR_CREATE                 = 11
*   DP_ERROR_SEND                   = 12
*   DP_ERROR_WRITE                  = 13
*   UNKNOWN_DP_ERROR                = 14
*   ACCESS_DENIED                   = 15
*   DP_OUT_OF_MEMORY                = 16
*   DISK_FULL                       = 17
*   DP_TIMEOUT                      = 18
*   FILE_NOT_FOUND                  = 19
*   DATAPROVIDER_EXCEPTION          = 20
*   CONTROL_FLUSH_ERROR             = 21
*   OTHERS   = 22
  .
IF SY-SUBRC = 0.
  WRITE : / 'data is downloaded'.
ENDIF.

Tutorial Comments

Total Comments: Add your Comment
29 Mar 2018

Thank you for providing each concept in detail and in a understandable language.

27 Jan 2022

ventolin generic salbutamol ventolin inhaler price philippines ventolin inhaler coupons family medicine doctors near me

16 Feb 2022

hydroxychloroquine 200 mg tab tablet countries that use hydroxychloroquine does hydroxychloroquine help with arthritis

05 Mar 2022

buy viagra online in usa

11 Mar 2022

buy ivermectin pills

12 Mar 2022

arimidex online

15 Mar 2022

yasmin prescription uk

16 Mar 2022

amoxicillin prescription cost

24 Mar 2022

lisinopril 20mg

31 Mar 2022

online pharmacy viagra cheap

04 Apr 2022

real cialis online

08 Apr 2022

purchase viagra online from canada

09 Apr 2022

cost of cialis with insurance

10 Apr 2022

trental 400 online buy

11 Apr 2022

motilium over the counter canada

11 Apr 2022

order generic viagra from canada

11 Apr 2022

cialis brand name buy online

12 Apr 2022

atenolol 5mg tablet

14 Apr 2022

stromectol covid 19

17 Apr 2022

100g clomid

20 Apr 2022

cheap doxycycline 100mg

21 Apr 2022

tetracycline cream brand name

24 Apr 2022

lopressor 20 mg

26 Apr 2022

augmentin generic brand

26 Apr 2022

abilify generic cost in uk

26 Apr 2022

cialis generic uk

26 Apr 2022

buy cheap sildenafil

26 Apr 2022

budesonide 9 mg tablets cost

27 Apr 2022

phenergan iv

27 Apr 2022

tadalafil tablets for female hindi

27 Apr 2022

para que sirve el bactrim

27 Apr 2022

amoxicillin 500 price uk

27 Apr 2022

where can you get viagra uk

27 Apr 2022

how to get priligy

27 Apr 2022

viagra 150 mg price

27 Apr 2022

ivermectin cream canada cost

27 Apr 2022

diflucan coupon canada

27 Apr 2022

phenergan on line

27 Apr 2022

vermox tablets nz

27 Apr 2022

chewable sildenafil

27 Apr 2022

stromectol price usa

27 Apr 2022

viagra online best price viagra

27 Apr 2022

where can i buy amoxicillin online

27 Apr 2022

viagra tablets pharmacy

28 Apr 2022

paroxetine 200 mg

28 Apr 2022

how much is 20 mg cialis

28 Apr 2022

cialis price comparison

28 Apr 2022

viagra online canada mastercard

28 Apr 2022

best accutane brand

28 Apr 2022

buy atarax online uk

28 Apr 2022

can you buy antabuse online

28 Apr 2022

order antabuse over the counter

28 Apr 2022

benicar 10 mg

28 Apr 2022

cheap plaquenil

28 Apr 2022

tadalafil medicine in india

28 Apr 2022

tetracycline 500 mg online

28 Apr 2022

sildenafil citrate 50mg tab

28 Apr 2022

how can i get fluoxetine

28 Apr 2022

online canadian pharmacy viagra

28 Apr 2022

feldene 20 mg tablet price

29 Apr 2022

ivermectin 0.5% lotion

29 Apr 2022

stromectol pills

29 Apr 2022

cheap generic tadalafil uk

29 Apr 2022

tadalafil generic cost

29 Apr 2022

cheap diflucan online

29 Apr 2022

cephalexin buy uk

29 Apr 2022

fluoxetine 250 mg

29 Apr 2022

doxycline

29 Apr 2022

pharmacy discount coupons

29 Apr 2022

prazosin 20 mg

29 Apr 2022

cialis canada 40mg

29 Apr 2022

synthroid 50mg

29 Apr 2022

inderal 10mg tab

29 Apr 2022

tizanidine canada

29 Apr 2022

diflucan over the counter canada

29 Apr 2022

stromectol drug

29 Apr 2022

cialis daily use 5 mg

29 Apr 2022

buy stromectol online uk

29 Apr 2022

buy cialis for daily use online

30 Apr 2022

phenergan medication

30 Apr 2022

indocin prescription

30 Apr 2022

trazodone 25 mg tablet

30 Apr 2022

prednisone purchase

30 Apr 2022

propranolol hemangioma

30 Apr 2022

generic sildenafil us

30 Apr 2022

synthroid 25 mcg tablet

30 Apr 2022

canadian pharmacy generic cialis

30 Apr 2022

ivermectin 3mg pill

30 Apr 2022

generic for indocin

30 Apr 2022

cost of cialis daily

30 Apr 2022

viagra purchase in canada

30 Apr 2022

best generic cialis

30 Apr 2022

cost of doxycycline 50 mg

30 Apr 2022

cheap viagra online uk

30 Apr 2022

canadian generic cialis online

30 Apr 2022

vermox medication

01 May 2022

viagra uk best price

01 May 2022

buy sildenafil online uk

01 May 2022

purchase prozac

01 May 2022

viagra online prescription

03 May 2022

tadalafil india pharmacy

04 May 2022

2000 mg neurontin

04 May 2022

diflucan canada coupon

07 May 2022

generic for effexor

07 May 2022

female viagra pill price in india

09 May 2022

tadalafil drug generic drug

12 May 2022

cialis online india

13 May 2022

sildenafil 120

13 May 2022

The best and hottest pg slot online slots website in Asia

13 May 2022

Online slots pg slot with the best and most secure service system of 2022

14 May 2022

clindamycin where can i buy

16 May 2022

propecia 10 years

16 May 2022

buy generic accutane online

17 May 2022

pharmacy no prescription required

18 May 2022

ivermectin 200mg

Leave a Comment

Enter Comment Text