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: 

select statement with package size

Former Member
0 Kudos

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.

4 REPLIES 4

Former Member
0 Kudos

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.

Former Member
0 Kudos

hi

good

i dont think there is any process which ll allow you to loop tha package size within the select satement.

thanks

mrutyun^

Clemenss
Active Contributor
0 Kudos

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

former_member248447
Participant
0 Kudos

we cannot loop through the package size since it is not an variable