2006 Jan 17 7:17 AM
I have an internal table which has 100 entries . I have a parameter on the selection screen which says how many entries to club.
Like if I say 5 entries on the screen to club , the program should submit 20 jobs, if 4 then 25, if 3 then 33 jobs with 3 entries and 1 job with one entry .
Any idea how this can be done easily ? Any sample code ?
Ankur Bhandari .
2006 Jan 17 7:20 AM
Ankur,
Have a counter inside the loop. Once the counter is equal to the value entered on the SELECTION screen, submit the job and reset the counter.
The loop is for the internal table that holds the data.
Regards,
Ravi
2006 Jan 17 7:24 AM
This is exactly what I did , but this fails for odd numbers also when the total no of entries which are there in the main internal table then the job won't get submitted.
Ankur Bhandari
2006 Jan 17 7:24 AM
if you are looking at loop at internal table to start at a particular index you can use
loop at itab FROM <counterstart> to <counterend>.
endloop .
Regards
Raja
2006 Jan 17 7:23 AM
Not sure but maybe this helps:
entries = 5.
i = 0.
do.
from = entries * i.
to = from + entries.
describe itab lines sy-tfill.
if sy-tfill lt to.
to = sy-tfill.
stop = 'X'.
endif.
loop itab from from to to.
endloop.
if stop eq 'X'.
exit.
else.
add 1 to i.
endif.
enddo.
Regards
Rene
2006 Jan 17 8:13 AM
Hi Ankur,
try:
PARAMETERS club TYPE i DEFAULT 7.
DATA entries TYPE i.
DATA rest TYPE i.
DATA counter TYPE i.
DESCRIBE TABLE itab LINES entries. "number of table entries
counter = trunc( entries / club )."number without rest
rest = entries MOD club."rest
*normal entries
DO club TIMES.
DO counter TIMES.
*submit ...
ENDDO.
ENDDO.
*rest - residuary
DO rest TIMES.
*submit...
ENDDO.
Andreas
2006 Jan 17 8:25 AM
append records to a tmp table and use sy-tabix that is the index of the appended record.
Then handle the line to the secondary table.
Then free the table.
parameters : split type i.
Data: tab1 type XXX occurs 0,
tab2 like tab1.
loop at tab1.
append tab1 to tab2.
check sy-tabix = split.
submit ....
.
.
.
free tab2.
endloop.
2006 Jan 17 9:08 AM