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: 

Duplicate records in internal table

Former Member
0 Kudos

Hi friends,

I have a requirement that , display only duplicate records and delete non-duplicate records,can any one help me on this issue,little bit urgent.Thanks in Advance

Moderator Message: Please frame your logic & get back to the forums in case you've any specific problems implementing it.

Edited by: Suhas Saha on Oct 20, 2011 1:46 PM

1 REPLY 1

prince_isaac
Active Participant
0 Kudos

Hi Guest12

try this


lt_data02[] = lt_data01[].

*declare an internal table of same structure as the one you have then move all values to it
*delete duplicates in the first table
DELETE ADJACENT DUPLICATES FROM lt_data01 COMPARING ALL FIELDS.

LOOP AT lt_data01 INTO lw_data01.
  READ TABLE lt_data02 INTO lw_data02 WITH KEY field_one = lw_data01-field_one.
  IF sy-subrc = 0.
    DELETE lt_data02 FROM lw_data02.
  ENDIF.
ENDLOOP.
*contents of lt_data02 should be the entries that had duplicate entries

regards

Prince Isaac