i have two internal tables namely itab1 itab2
itab1 contains 3 records
itab2 contains 1 lakh records
whatever the 3 records in the itab1 will be in the itab2...
my requirement is i want to delete all the records other than that 3 records. in itab2.....
how to do this..?
Edited by: kiran kumar on Sep 1, 2008 7:10 AM
As you want to delete data of one table based on records in another table.
For this you can use this type of logic,
LOOP AT i_tab1 INTO fs_tab1. w_tabix = sy-tabix. IF i_tab2 IS INITIAL. DELETE i_tab1. ELSE. READ TABLE i_tab2 INTO fs_tab2 WITH KEY vbeln = fs_tab1-vbeln. IF sy-subrc NE 0. DELETE i_tab1 INDEX w_tabix. ENDIF. ENDIF. ENDLOOP.