2007 Dec 14 6:57 AM
I will have 1000's of recs in an itab .
many sales orders data and many recs for each sales order.
and i have to delete the corresponding recs from database based on 2 conditions.
1. for each sales order, leave the latest rec and delete all other recs 4m DB
2. am asked 2 perform commit after every 500recs.
how can I use this commit logic.
thanks
kiran
2007 Dec 14 7:20 AM
2007 Dec 14 7:28 AM
Hi Kiran, do something like this :
data : w_count type i.
loop at itab.
if w_count = 500.
commit.
clear w_count
endif.
endloop.
Hope this helps,
Erwan
2007 Dec 14 7:35 AM
loop at itab .
at end of itab-vbeln.
continue.
endat.
move itab to itab1.
append itab1.
if sy-tabix mod 500 EQ 0.
delete DBtab from itab1.
commit work and wait.
refresh itab1.
endif.
endloop.
for remaining records in itab1 after looping
delete DBtab from itab1.
commit work and wait.
**hope the logic helps. but this is not advisable to do on std tables, do only on Ztables