‎2008 Feb 18 5:47 AM
HI,
I have two internal tables itab1 and itab2 which have same records initially.Later some records of itab2 are deleted .Then i want to delete those records from itab1 also ie,those records not found in itab2 .Is there any method other than looping.
So that itab1 again becomes equal to itab2.
Thanks in advance.
Sowmya.
‎2008 Feb 18 5:50 AM
‎2008 Feb 18 5:53 AM
Hi Sowmya,
The two way outs:
1) if you have make itab1 = itab2 then you can simply move itab2 to itab1 this will overwrite the records in itab1 with the records of itab2..
2) whereever you are deleting the record ffrom itab2 there delete the same record from itab1 also so that no extra loop ia requied to make these tables equal.
reward points if useful...
‎2008 Feb 18 5:55 AM
Hi Sowmya,
The two way outs:
1) if you have make itab1 = itab2 then you can simply move itab2 to itab1 this will overwrite the records in itab1 with the records of itab2..
2) whereever you are deleting the record ffrom itab2 there delete the same record from itab1 also so that no extra loop ia requied to make these tables equal.
reward points if useful...
‎2008 Feb 18 5:55 AM
YOU HAVE TO USE - DELETE TABLE itab [FROM wa].
you need to loop at in your itab2 into your work area , and then delete the corresponding entry from your itab1.
reward if useful
Varun Mathur
Edited by: Varun Mathur on Feb 18, 2008 6:55 AM
‎2008 Feb 18 5:56 AM
Soumya,
Itab1 , Itab2 .
Before deleting the records from itab2 move those records to one more internal table itab3.
Now you have deleted records of itab2 in itab3.
SORT ITAB3,ITAB1 by your main key field.
LOOP AT itab3.
READ TABLE ITAB1 WITH KEY key field = itab3-
keyfield.
IF sy-subrc EQ 0.
DELETE itab1 where keyfield eq itab3-keyfield.
ENDIF.
ENDLOOP.