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: 

deleting unique entries in atable.

Former Member
0 Kudos

hi all,

i have sorted an internal table based on 3 fields.

my requirement is i have to delete the unique entries in that internal table and keep the duplicate entries in the table.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Do one thing first copy the entire table into one temp table then sort that and delete the duplicate entries from temporary table using the DELETE ADJACENT DUPLICATES stmt, now you have unique entries in temparory table. Now delete your original internal table entries using the temparary table, now the unique entries are there in your original table. This is the simpliest way to do...

Rgds,

Bujji

Former Member
0 Kudos

hi,

say ur internal table is itab.

create temp table of the same structure itab_temp.

itab_temp[] = itab[].

sort itab_temp by ...

delete adjacent duplicates from itab_temp comparing..

loop at itab.

read table itab_temp with key ..

if sy-subrc = 0.

delete...

endif.

endloop.

itab will have duplicate entries now.

regards,

madhu