11-17-2008 8:06 AM
DELETE ADJACENT DUPLICATES FROM itab.
Deletes the all duplicate row except first one.
Searching for the all the duplicate rows should get deleted except last one.
11-17-2008 8:20 AM
Hi Reshma,
Before using the DELETE ADJACENT DUPLICATES......You should always sort the internal table. Now if the records are as follows :
001 abc 10000
001 abc 1000
002 def 20000
002 def 2000
003 xyz 30000
003 xyz 3000
Out of these entries suppose you want only three entries that is
001 abc 1000
002 def 2000
003 xyz 3000
now sort the table by amt ascending. then the entries in the table will be
001 abc 1000
001 abc 10000
002 def 2000
002 def 20000
003 xyz 3000
003 xyz 30000
Now DELETE ADJACENT DUPLICATES....
Check your entries. This will solve.
Regards,
Swapna.
11-17-2008 8:11 AM
Is there any other key in the itab on which you can short itab and then SORT itab by that key and then delete itab comparing that key.
11-17-2008 8:12 AM
Hi Reshma,
Sort the itab in descending order of the fields that you want the records for, and then write DELETE ADJACENT DUPLICATES FROM itab. When you'll sort by descending order, the last record should be on the top and will be kept deleting the remaining records.
regards,
Advait
11-17-2008 8:13 AM
Hi,
DELETE ADJACENT DUPLICATES FROM itab comparing field1,field2......or all fields.
But before doing this...you have to sort your internal table with respect to those field1,field2....then use the syntax of Delete.
Arunima
11-17-2008 8:15 AM
Hi,
sort the internal table with some Keys as per your requirement and then use Command:
DELETE ADJACENT DUPLICATES FROM itab
COMPARING <field names on which you sorted the table>
this will delete the duplacte records by comparing the fields.
11-17-2008 8:17 AM
use the below syntax.
sort itab by <fields1> <field2> .......... ascending.
delete adjacent duplicates from itab.
11-17-2008 8:20 AM
Hi Reshma,
Before using the DELETE ADJACENT DUPLICATES......You should always sort the internal table. Now if the records are as follows :
001 abc 10000
001 abc 1000
002 def 20000
002 def 2000
003 xyz 30000
003 xyz 3000
Out of these entries suppose you want only three entries that is
001 abc 1000
002 def 2000
003 xyz 3000
now sort the table by amt ascending. then the entries in the table will be
001 abc 1000
001 abc 10000
002 def 2000
002 def 20000
003 xyz 3000
003 xyz 30000
Now DELETE ADJACENT DUPLICATES....
Check your entries. This will solve.
Regards,
Swapna.