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: 

probelm with DELETE ADJACENT DUPLICATES

Former Member
0 Kudos

Hi Guys!

Here's the scenario, I have this syntax in my report..

delete adjacent duplicates from it_itab comparing matkl sptag+0(6)

The values inside the it_tab is as follows..

20080301|01010402

20080301|02024301

20080305|01010402

20080310|01010402

when I debug it, and used the syntax delete adjacent duplicates from it_itab comparing matkl sptag+0(6),

the output will be like this....

20080301|01010402

20080301|02024301

20080305|01010402

I dont know why this output showed up. I'm expecting do have this output

20080301|01010402

20080301|02024301

Could someone explain why this happened? Is there a problem or loop hole in delete adjacent duplicate?

Please help! thanks so much!

Regards,

Mackoy

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos

sort it with the fields u want to compare and delete, before delete adjacent duplicates statement...

5 REPLIES 5

former_member156446
Active Contributor
0 Kudos

sort it with the fields u want to compare and delete, before delete adjacent duplicates statement...

Former Member
0 Kudos

You should sort in the same order of fields that you compare with, before you use the DELETE ADJACENT DUPLICATES statement. Otherwise the statement is ineffective.

Reward if useful,

Thanks,

Rahul

Former Member
0 Kudos

hi

do this:

sort it_itab by matkl sptag.

delete adjacent....

delete adjacent will always look for the adjacent entries, and if a dupliacte is found then it deletes the 2nd records.

for ex , u have,

var1

123

123

124

125

123

in this case....2nd record is deleted and the output will be

123

124

125

123 . if it was sorted by var1 and then delete adjacent duplicates was used then it will have unique records.

regards,

madhumitha

Former Member
0 Kudos

You should sort the fields before that..

sort it_itab by matkl sptag.

delete adjacent duplicates from it_itab comparing matkl sptag+0(6)

Former Member
0 Kudos

Hi Guys!

Thanks a lot guys!!

Regards,

Mackoy