08-01-2007 8:38 PM
Hi,
I have an internal table with n records.
I want to use at a time say max of 20 records .
This is calling a BDC.
i.e.
loop at n record.
take 20 records.
call BDC.
then next set of recrds.
repeat process till all records processed.
Thanks in Advance.
Amit
08-01-2007 8:50 PM
Hi,
try this way.
data: count type i.
loop at table
if count LE 20.
add 1 to count.
else.
clear count.
call bdc.
"refresh all the concerned tables and variables for the next 20 records.
endif.
endloop.
Or.
loop ...
WHILE count le 20.
ADD 1 TO count.
...
ENDWHILE.
clear count.
call bdc.
"refresh all the concerned tables and variables for the next 20 records.
endloop
Regards.
Marcelo Ramos
08-01-2007 8:43 PM
Try something like this
data: remainder type i.
loop at itab.
remainder = sy-tabix mod 20.
if remainder = 0.
*-- twenty records are accumulated
call bdc.
refresh all the concerned tables and variables for the next 20 records.
else.
accumulate the records until you have 20 records.
endif.
endloop.
08-01-2007 8:45 PM
Hi Amit,
Maintain a counter to take 20 records to process and repeat the process still all records are completed.
DATA V_COUNT TYPE I.
DATA C_COUNT TYPE I VALUE '20'.
LOOP AT ITAB.
V_COUNT = V_COUNT + 1.
IF V_COUNT = 20.
CALL TRANSACTION ....for 20 records
REFRESH BDCDATA.
CLEAR V_COUNT.
ENDIF.
ENDLOOP.
IF V_COUNT IS NOT INITIAL AND V_COUNT < C_COUNT.
CALL TRANSACTION ....for 20 records
REFRESH BDCDATA.
ENDIF.
Thanks,
Vinay
08-01-2007 8:47 PM
Hi,
data : v_index like sy-tabix
loop at itab
move corresponding itab to itab_t.
append itab_t
if v_index <= 20.
v_index = v_index + 1.
continue.
else.
clear v_index .
perform BDC using itab_t.
refresh itab_t
endif.
endloop.
aRs
08-01-2007 8:50 PM
Hi,
try this way.
data: count type i.
loop at table
if count LE 20.
add 1 to count.
else.
clear count.
call bdc.
"refresh all the concerned tables and variables for the next 20 records.
endif.
endloop.
Or.
loop ...
WHILE count le 20.
ADD 1 TO count.
...
ENDWHILE.
clear count.
call bdc.
"refresh all the concerned tables and variables for the next 20 records.
endloop
Regards.
Marcelo Ramos
08-01-2007 8:58 PM
I hope this may be alternative....
loop at itab
count = count + 1.
if count = 20.
call BDC. "Using itab1 which holds 20 records
clear count.
refresh itab1.
else.
APPEND LINES OF itab TO itab1
endif.
Reward all usefuls
Thanks & Regards
vinsee