Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to Compare 2 internal table data...

Former Member
0 Likes
668

Hi Experts,

i ve 2 internal tables, both contains NRIC numbers...

now i want to compare whether the both table data is same or not?

i tried like

if itab1[] = itab2[].

but its not working...

how 2 compare both tables are having matching data r not?

Thanks in Advance,

sudeer.

Hi Experts,

i ve 2 internal tables, both contains NRIC numbers...

now i want to compare whether the both table data is same or not?

i tried like

if itab1[] = itab2[].

but its not working...

how 2 compare both tables are having matching data r not?

Thanks in Advance,

sudeer.

3 REPLIES 3
Read only

Former Member
0 Likes
631

if the internal tables defined are having the same structure then you can compare the way you did.

if itab1[] = itab2[].
 "they are same
else.
 " they are not equal
endif.

if they are not working means the two internal tables may be different check in debug mode once and see.

Read only

0 Likes
631

Hi Vijay,

thanks for ur replay...

i ve done same thing what u ve given, but its not working........

but both tables having same data....no doubt on that...

my require ment is i ve contants in both tables..

i want 2 check if both should have same no of records and contant also should be same...

.

Read only

former_member156446
Active Contributor
0 Likes
631

loop at itab1 into wa_itab1.
  read table itab2 into wa_itab2 with key NRIC = wa_itab1.
     if sy-subrc eq 0.
           Delete itab1 index sy-index.  " or
           Delete itab2 index sy-index.
     endif.
endloop.