Skip to Content
author's profile photo Former Member
Former Member

Package Size

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?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 09:19 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2007 at 06:18 AM

    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>

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.