Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to Compare two itab and delete entries....

Hi Experts,

In itab1 table there are following entries.

Vbeln posnr

360 1

360 2

360 3

361 1

361 2

362 1

362 2

363 1.

In itab2 table there are following entries.

Vbeln

360

362

I want to compare both itab and delete all vbeln from itab1 which are not in itab2.

How to write ? Guide me.

Yusuf

Tags:
Former Member
Former Member replied

Hi,yusuf.

This is my answer,I tested it,it works.

LOOP AT TAB_TABLE1 INTO WA_TABLE1.

READ TABLE TAB_TABLE2 WITH KEY VBELN = WA_TABLE1-VBELN INTO WA_TABLE2.

IF SY-SUBRC <> 0.

DELETE TABLE TAB_TABLE1 FROM WA_TABLE1.

ENDIF.

ENDLOOP.

Regards,

feng.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question