Skip to Content

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

how to compare the two same fields of different tables

Hi can any one let me know the logic for compare the two fields of different tables.

Tags:
Former Member
Former Member replied

hi

good

IF it_1[] = it_2[].

" Tables contents are the same

ELSE.

" Tables contents are different

ENDIF.

If they have different structure, you probably must loop one of the tables, and inside read the other, then compare field by field.

Or if you don't need the contents (just comparing) you can do this, for example:

LOOP AT it_1 INTO wa_1.

READ TABLE it_2 WITH KEY field2 = wa_1-field2

field5 = wa_1-field5

TRANSPORTING NO FIELDS.

IF sy-subrc = 0.

" Record is on both tables (field2 and field5 are the fields in common for both tables).

ENDIF.

ENDLOOP.

thanks

mrutyun^

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question