02-12-2008 5:43 PM
hii i have taken material from lips in first internal table and material from vepo in second internal table
now i want only those entries in second table which r present in first table.
one delivery can have multiple materials in it.
please provide logic.. <REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 12, 2008 2:45 PM
02-12-2008 5:47 PM
LOOP AT itab2.
lv_index = sy-index.
READ TABLE itab1 WITH KEY matnr = itab2-matnr.
IF sy-subrc NE 0.
DELETE itab2 AT INDEX lv_index.
ENDI.
ENDLOOP.
At the end of loop itab2 will have only entries available in itab1.
Regards
Sudhir Atluru
02-12-2008 5:47 PM
LOOP AT itab2.
lv_index = sy-index.
READ TABLE itab1 WITH KEY matnr = itab2-matnr.
IF sy-subrc NE 0.
DELETE itab2 AT INDEX lv_index.
ENDI.
ENDLOOP.
At the end of loop itab2 will have only entries available in itab1.
Regards
Sudhir Atluru
02-12-2008 9:01 PM
apart from the above answert.... Sort the itab1 and use binary search in read statement (if you think, you will have more than 100 records).