‎2006 Jul 01 6:50 AM
Hi Folks
can any one explain the conceots if packet size in the select query ..
‎2006 Jul 03 6:50 AM
Hi ,
Its Package Size not packet Size ,
<b>Effect
Works like ... INTO wa, except that the selected data is not placed in the internal table itab line by line, but in one single operation. In this case, SELECT does not introduce a processing loop, so there can be no ENDSELECT statement. The old contents of itab are overwritten. Fields of the internal table itab which are not filled are initialized based on their ABAP data type (see DATA).
In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs.See Open SQL and Unicode.
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 100,
wa_itab TYPE scarr.
WA_ITAB TYPE SCARR.
SELECT * INTO TABLE itab FROM scarr.
LOOP AT itab INTO wa_itab.
WRITE: / wa_itab-carrid, wa_itab-carrname.
ENDLOOP.
Addition
... PACKAGE SIZE n
Effect
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.</b>
Regards
Prabhu
‎2006 Jul 03 6:57 AM
For efficiency, always do the inserts in key sequence order.
If you are inserting a lot of records (and it seems like it here), you will be in danger of exceeding the rollback area. The way around this is to insert a number of records at a time and then do an explicit commit. That's why I suggested doing it this way:
DATA: BEGIN OF ztab_int OCCURS 0.
INCLUDE STRUCTURE ztab.
DATA: END OF ztab_int.
SELECT * FROM ztab INTO TABLE ztab_int
PACKAGE SIZE 5000.
INSERT z_tab1 FROM TABLE ztab_int.
COMMIT WORK.
ENDSELECT.
The package size you should use depends on the structure size of the table you are inserting and the size of the rollbacke area. Your DBAs should be able to help you in this.
You cannot simply restart this program if it fails. You either have to empty the z table first or skip the records you have already inserted
‎2006 Jul 03 7:06 AM
<<Documentation from SAP_HELP>>>
SELECT ... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE <itab>
[PACKAGE SIZE <n>] ...
If you use the PACKAGE SIZE addition, the lines of the selection are not written into the internal table at once, but in packets. You can define packets of <n> lines that are written one after the other into the internal table. If you use INTO, each packet replaces the preceding one. If you use APPENDING, the packets are inserted one after the other. This is only possible in a loop that ends with ENDSELECT. Outside the SELECT loop, the contents of the internal table are undetermined. You must process the selected lines within the loop.
‎2006 Jul 03 7:10 AM
HI
GOOD
GO THROUGH THESE LINKS, I HOPE THESE WILL HELP YOU TO SOLVE YOUR PROBLEM
http://www.aes-clever.co.uk/clever-ctrace.htm
THANKS
MRUTYUN
‎2006 Jul 03 7:16 AM
Hi srinivas,
1. READ ALL RECORDS IN ONE SHOT (IN ONE BUNCH)
(normal select query)
READ RECORDS IN <b>SMALL-SMALL BUNCHES</b>
(using packet concept)
2. The above is the main difference, and usage,
of packet concept.
3. Just copy paste to get a taste of it.
4.
REPORT abc.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : ctr TYPE i.
*----
selection screen.
PARAMETERS : a TYPE c.
*----
START-OF-SELECTION.
SELECT * FROM t001
INTO TABLE t001
PACKAGE SIZE 5 .
ctr = ctr + 1.
WRITE 😕 '----
Loop Pass # ' , ctr.
LOOP AT t001.
WRITE 😕 t001-bukrs , t001-butxt.
ENDLOOP.
ENDSELECT.
regards,
amit m.