‎2007 May 03 9:30 AM
Hi,
is there any way where i can loop the package size within select statement, say for ex.
select * from tstc into table itab package size 1000.
write : sy-dbcnt.
loop into ipackage
do processing
endloop.
endselect.
the output will be 1000 2000 3000 .... 10000
here can i loop the above data in chunk of 1000 till the last record of table i.e. output first 1000 records than next 1000 and so on...
& this i want to complete in single select statement.please let me
is this possible on the ECC 6.0 system.
Thanks,
John.
‎2007 May 03 12:25 PM
Hi John dias ,
I dont think this can be done in one hit. We too tried for this earlier but we have written logic for this. Please let me know if U can find solution for this.
‎2007 May 03 12:29 PM
hi
good
i dont think there is any process which ll allow you to loop tha package size within the select satement.
thanks
mrutyun^
‎2007 May 03 12:54 PM
Hi John,
maybe i haven't got the question right. I tried this:
FORM package .
DATA:
lt_but000 TYPE TABLE OF but000.
FIELD-SYMBOLS:
<but000> TYPE but000.
SELECT
partner bu_sort1
INTO CORRESPONDING FIELDS OF TABLE lt_but000
PACKAGE SIZE 100
FROM but000.
WRITE: / sy-dbcnt.
* some processing - i this case it does not make too much sense
LOOP AT lt_but000 ASSIGNING <but000>.
* AT FIRST.
* WRITE: /.
* ENDAT.
* WRITE: <but000>-bu_sort1(1).
ENDLOOP.
ENDSELECT.
ENDFORM. " package
and it works very well. I commented out the processing in the LOOP to get the output
100
200
...
1.400
1.441
in development system. Don't mind about me using field-symbol. It is the same as INTO clause but faster. In the loop you can do what you want to do with the data.
Regards,
Clemens
‎2007 May 03 2:53 PM
we cannot loop through the package size since it is not an variable