Application Development 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: 

compare records

Former Member
0 Kudos

In the itab for ex.

no code

-


1 ht

1 ht

1 ht1

I want to compare these record.ie 1st rec with all other records and 2nd with all other rec etc. How can I do this. Or else can I find the count.How?Plz help me..

3 REPLIES 3

Former Member
0 Kudos

data:count type i.

loop at itab into wA.

at new field1.

clear count.

count = count + 1.

endat.

count = count + 1.

endloop.

Message was edited by:

Karthikeyan Pandurangan

former_member223537
Active Contributor
0 Kudos

data : l_lines type sy-tabix.
describe table itab lines l_lines.
loop at itab into watab.
l_tabix = sy-tabix + 1.
loop at itab into wtemp from l_tabix to l_lines where matnr = watab-matnr.
write 😕 'duplicate record exists'.
endloop.
clear : l_tabix,
          watab,
          wtemp.
endloop.


Former Member
0 Kudos

Hello Suganya,

Do you want to compare the records or do u need something else?

If u want to compare the records, then u can do it in nested loops.

Eg : Consider i_tab1 is first internal table with header lines.

i_tab2 is second internal table with header lines.

loop at i_tab1.

loop at i_tab2 where field1 = i_tab1-field1 and

field2 = i_tab1-field2 and

fieldN = i_tab1-fieldN.

  • if the control enters the second loop, then duplicate records exists.

  • if u want to count the duplicate records,set a counter & increment the counter

endloop.

endloop.