Application Development and Automation 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: 
Read only

Delete duplicate records without sort and adjacent

Former Member
0 Likes
1,264

Hi Experts,

We are generating a .txt file thru an ABAP report program. This file should be in a prestructured format and that is the reason why we cannot sort any of the file fields. I would like to know if there is any way in ABAP that allow us to delete duplicate records without sorting and adjacent.

Or

do i have to create an other internal table as a copy of file internal table and compare each record in first file with other records in the second file. I really do not wont to go with this logic as it can create performance issue.

Please suggest us with the best methods to do this.

Thank you

Mamatha

Hi Experts,

We are generating a .txt file thru an ABAP report program. This file should be in a prestructured format and that is the reason why we cannot sort any of the file fields. I would like to know if there is any way in ABAP that allow us to delete duplicate records without sorting and adjacent.

Or

do i have to create an other internal table as a copy of file internal table and compare each record in first file with other records in the second file. I really do not wont to go with this logic as it can create performance issue.

Please suggest us with the best methods to do this.

Thank you

Mamatha

3 REPLIES 3
Read only

Former Member
0 Likes
869

Hi,

Search about this two tips:

- DELETE ADJACENT DUPLICATE ENTRIES FROM COMPARING ALL FIELDS.

I think you don't have to SORT the tables to use it.

Hope it helps you...

--

Alexis Sánchez N.

SAP ABAP Development Consultant

<< You were asked just yesterday to refrain from including company specific content >>

Edited by: Rob Burbank on Apr 13, 2010 4:19 PM

Read only

Former Member
0 Likes
869

I'd ceate another table that includes the fields AND the position in the original table. Then I'd sort the second table and loop through it, adding a counter and a short position itable. While looping I'd store the positions and using AT END OF the name of the last field in the sort to check the counter. If it's 1, no problem. If it's greater than 1, then you'll need to decide which one to keep and delete the rest of the entries in the positions minitable. Then clear the counter and the positions table and continue looping.

Read only

Former Member
0 Likes
869

Hi,

You can create two internal table with the same structure and copy all the contents to one of the new internal table.

Sort this new internal table and use a delete adjecent duplicates statement on it.

Now you can loop on the first internal table and inside the loop have a read statement on the second internal table passing key

fields(or the fields that are bound to return unique records). If you get sy-subrc 0 append the work area to the third internal table

else ignore it.

Regards,

Sagar