Skip to Content
0
Former Member
Nov 03, 2009 at 10:02 AM

Delete entries not in a Table

16 Views

Hi,

I have 2 tables :

WT_TABLE1

INTRENO | OBJNR

0001 | IS001

0002 | IS002

0003 | IS003

0004 | IS004

0005 | IS001

WT_TABLE2

0001 | IS001

0003 | IS003

I want detele entries in WT_TABLE1 who is not in table WT_TABLE2.

I have a code that work but i need to know if they are instruction with better performance?

LOOP AT WT_TABLE1 into WS_TABLE1

READ TABLE WT_TABLE2 INTO WS_TABLE2

WITH KEY OBJNR = WS_TABLE1-OBJNR.

if sy-subrc <> '0'.

delete wt_contrat.

endif.

ENDLOOP.

Thank you for your reply.

Spawntae