Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Package Size

Former Member
0 Kudos

I noticed a SELECT/ENDSELECT statement in an existing program that had a vast majority of the program enclosed in it and I wanted to just select into an internal table and loop at it. I noticed that it uses a package size and the default size is 5000. I've never seen this used before. Is it better to process the records 5000 at a time than to just put all the records (however many that may be) into an internal table at once? Which one would hold up the database more?

2 REPLIES 2

Former Member
0 Kudos

The PACKAGE SIZE option of the SELECT statement is used when you expect to be SELECTing more data than can be held in the internal tables. In other words, without it, the program will dump due to memory issues.

5,000 seems small. If you want, try increasing it to 10,000. This will reduce the number of trips to the database, but then again, it may dump.

Rob

Former Member
0 Kudos

HI

<b>PACKAGE SIZE n</b>

Works like ... INTO wa, except that the selected data is not placed in the internal table itab line by line, but in packets of n lines. The old contents of itab are overwritten.

n <= 0 causes a runtime error.

Internally, n is placed in a type I field. Here, the usual conversion rules apply (see MOVE).

After leaving the processing loop, the contents of the internal table itab are undefined.

If the result of the selection is a table, the data is retrieved in a processing loop introduced by SELECT and concluded by ENDSELECT. The processing passes through the loop once for each line read.

Example

Output a list of all airlines (with short description and name):

DATA: itab TYPE STANDARD TABLE OF SCARR WITH NON-UNIQUE

DEFAULT KEY INITIAL SIZE 10.

FIELD-SYMBOLS: <FS> TYPE scarr.

SELECT * INTO TABLE itab PACKAGE SIZE 20 FROM scarr.

LOOP AT itab ASSIGNING <FS>.

WRITE: / <FS>-carrid, <FS>-carrname.

ENDLOOP.

ENDSELECT.

<b>Reward i fusefull</b>