delete lines from ITAB2 that are not in ITAB1

Question: Hi,
1st I went through the forum but couldn't able to find relevant information for the reason being am creating this thread.

I've 2 internal tables defined as follows.

DATA: BEGIN OF ITAB1 OCCURS 0, " WITH HEADER LINE,
SIGN(1) TYPE C,
OPTION(2) TYPE C,
LOW LIKE /BI0/PMATERIAL-MATERIAL,
HIGH LIKE /BI0/PMATERIAL-MATERIAL,
END OF ITAB1.

DATA: BEGIN OF ITAB2 OCCURS 0.
INCLUDE STRUCTURE ZSTRU.
DATA: END OF ITAB2.

structure ZSTRU has a field ZMAT.

Both ITAB1 & ITAB2 holds materials.

What I am trying to do is....
delete lines(materials) from ITAB2 that are not in ITAB1.

Greatly appreiate any help.

Answer:
loop at itab2.
read table itab1 with key matnr = itab2-matnr.
if sy-subrc ne 0.
delete itab2.
endif.
endloop.
Copyright ?2007 - 2008 www.jt77.com