Hi Kiran,
As per your requirement, you need to loop both the tables. Check the contents of the 2nd Table with the contents of the 1st table and delete all those records from table 1.
I think if there are more number of entries in the 2nd table and you need to delete the entries in the 1st table, then you can loop over the 2nd and mark the entries for deletion in the 1st table. Then after the loop is over, you can delete them at the end. I have given a sample code.
Please note that this is not a good code from a performance perspective. You can still optimize it using either by creating sorted table or by the parallel cursor concept. Let me know if you need any pointers in that aspect.
Loop at itab2 into wa2.
Loop at itab1 into wa1 where key1 = wa2-key1.
clear wa1-key1.
Endloop.
Endloop.
Delete itab1 where key1 is initial.
Hope this will help. Let me know the outcome.
Thanks in advance.
Best Regards,
Samantak Chatterjee.