2010 Apr 13 7:51 PM
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
2010 Apr 13 9:08 PM
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
2010 Apr 13 9:40 PM
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.
2010 Apr 14 7:44 AM
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