09-17-2008 6:36 AM
Hi All,
I have used this code to delete duplicate entries from an internal table.
DELETE ADJACENT DUPLICATES FROM IT_KOSTL COMPARING KOSTL hours.
After this statment, still the internal table will remain with a duplicate row.
Earlier table content before the delete statement:
Lno KOSTL PRCTR hours hours1
1 2081010205 0000208101 5525.000 1574.500
2 2081010105 0000208101 105162.000 73854.750
3 2081010105 0000208101 105162.000 73854.750
4 2081010205 0000208101 5525.000 1574.500
The Table gets modified after execution of DELETE statement as follows.
Lno KOSTL PRCTR hours hours1
1 2081010205 0000208101 5525.000 1574.500
2 2081010105 0000208101 105162.000 73854.750
3 2081010205 0000208101 5525.000 1574.500
Why the line 3 is still present in the table?
I hope as per that syntax, this line too should get delete.... Is it right?
Basically i would like to delete both line 3 and line 4 from....
How to resolve this issue?
Please help me out....
Regards
Pavan
What might be the reason?
09-17-2008 6:38 AM
Hi,
Sort the internal table first.
I think you haven't used COMPARING <fields> addition thats why duplicate records are not getting deleted.
Regards
Abhijeet
09-17-2008 6:38 AM
Please post your entire code so we can take a look at it.
Sort it first. That will do the trick.
09-17-2008 6:38 AM
Hi,
Sort the internal table first.
I think you haven't used COMPARING <fields> addition thats why duplicate records are not getting deleted.
Regards
Abhijeet
09-17-2008 6:52 AM
>
> I think you haven't used COMPARING <fields> addition thats why duplicate records are not getting deleted.
NO.
He used comparing fields:
DELETE ADJACENT DUPLICATES FROM IT_KOSTL COMPARING KOSTL hours.
God know what's was the problem apart from sorting and problem solved by giving random marks.
09-17-2008 6:58 AM
Oops!
I didn't notice that. Anyways Thanks Amit for pointing out my mistake. Next time it won't happen.
09-17-2008 7:08 AM
09-17-2008 6:39 AM
hii
first sort internal table then use DELETE statement.i hope it works.
regards
twinkal
09-17-2008 6:40 AM
09-17-2008 6:42 AM
Hi
First sort your <itab> with key fields.
Then delete adjacent duplicate entries from <itab> comparing all fields.
hope this will work....
09-17-2008 6:46 AM
Hi
Use the below statement before your DELETE statement.
SORT IT_KOSTL BY KOSTL HOURS.
DELETE ADJACENT compares the adjacent records before deletion by comparing given fields, hence you have to sort internal table according to them before deletion.
Regards
Vijai
09-17-2008 6:49 AM
>
> DELETE ADJACENT DUPLICATES FROM IT_KOSTL COMPARING KOSTL hours.
> Why the line 3 is still present in the table?
>
> I hope as per that syntax, this line too should get delete.... Is it right?
>
Let me answer you all doubts.
Why the line 3 is still present in the table?
Actually it's not 3rd line, it's 2nd line.3rd line were deleted.
when delete adjecent duplicates trigger than it would delete lower line(3rd in your case) not upper line.
I hope as per that syntax, this line too should get delete.... Is it right?
NO.
09-17-2008 7:01 AM
sort the internal table by kostl and delete adjacent duplicates .
thank you,
govinda chary.
07-01-2015 10:18 AM