Skip to Content

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

Internal Table, delete NOT duplicates

Hi,

I have an internal table with these records.

How to delete records that are not the same?

10RR10 | 60 | 20

10RR10 | 60 | 21

10RR10 | 59 | 13

10RR10 | 59 | 13

10RR10 | 57 | 20

10RR10 | 57 | 21

Result should be this:

10RR10 | 59 | 13

10RR10 | 59 | 13

tnx, Adibo.

Tags:
replied

A possible solution:

data: l_count type i.

sort itab1 by field1 field2 field3.

itab2[] = itab1[]. " itab1 is your original table

loop at itab1.
  l_count = 0.

  loop at itab2 where field1 = itab1-field1 
		and field2 = itab1-field2
 		and field3 = itab1-field3.
    l_count = l_count + 1.

  endloop.

  if l_count eq 1.
    delete itab1.
  endif.


endloop.

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