2008 Jul 30 7:22 AM
Hi,
I have a requirement for delete adjacent records,
DELETE ADJACENT DUPLICATES FROM IT_OPSALES COMPARING BUKRS ENAME NAME1 BSTKD VBELN AUDAT POSNR MATNR .
Is it mandatory to sort internal table before delete adjacent ??
regards
Mark
2008 Jul 30 7:28 AM
Hi,
Yes Mark, It is mandatory to sort before deleting adjacent records, or else the system compares only with adjacent records. If the adjacent is not found as same ,it wont be deleted. At the end of all, the duplicate will still exists after deletion.
regards
Jijo
2008 Jul 30 7:23 AM
Hi Mark,
It is very compulsory to sort the table when you use the statement DELETE ADJACENT DUPLICATES. Because it checks if the adjacent record is similar . If it is similar it will delete else it will not delete. So it is compulsory to sort in order to get the appropriate output.
Regards,
Swapna.
2008 Jul 30 7:23 AM
hi,
Yes sort it on BUKRS ENAME NAME1 BSTKD VBELN AUDAT POSNR MATNR fields ...
i.e,
sort IT_OPSALES by BUKRS ENAME NAME1 BSTKD VBELN AUDAT POSNR MATNR.
2008 Jul 30 7:24 AM
Hi
Yes it is Mandatory to sort the internal table because as soon as you sort the Table all the SAME entries come Adjacent to each other so there after your statement works properly
Regards
Pavan
2008 Jul 30 7:24 AM
Hi,
Yes , It is mandetory.
For detail please check
http://help.sap.com/saphelp_nw04/Helpdata/EN/06/aafd54fc4011d195280000e8353423/content.htm
Regards,
Anirban
2008 Jul 30 7:25 AM
Hi Mark,
Yes Mark, it always better to SORT the internal table before you use DELETE ADJECENT DUPLICATES..
Best regards,
raam
2008 Jul 30 7:26 AM
Hi,
yes sorting is mandatory.
after sorting only u can do the delete adjacent duplicates.
when we sort all the data which are same come one after one so u can delete the adjacent duplicate data.
2008 Jul 30 7:27 AM
Hi,
After selecting the data into internal table. first we have to sort that internal table and use delete adjacent.
example:
select * from zse_role into itab_role.
sort itab_role by i_rolecd.
delete adjacent duplicates from itab_role.
Cheers,
vasavi.v
2008 Jul 30 7:28 AM
Hi,
Yes Mark, It is mandatory to sort before deleting adjacent records, or else the system compares only with adjacent records. If the adjacent is not found as same ,it wont be deleted. At the end of all, the duplicate will still exists after deletion.
regards
Jijo
2008 Jul 30 7:30 AM
Hi Mark,
You need to definitely SORT before using DELETE ADJACENT DUPLICATES
As you are using COMPARING in delete with some fields you need to SORT the table with those fields.
Regards,
Chandra Sekhar
2008 Jul 30 7:31 AM
hi
let us we have an table with following record in itab1
F1 F2 F3 F4
a b c d
c x y z
a b d e
c x y h
now here if i apply
DELETE ADJACENT DUPLICATES FROM ITAB1 COMPARING F1 F2 .
here no record wil be deleteted
but if u sort the itab1
and then apply
DELETE ADJACENT DUPLICATES FROM ITAB1 COMPARING F1 F2 .
u have only two record
spo it is always recomended to apply sort defore delete adjacent
Cheers
Snehi
2008 Jul 30 7:33 AM
as all have said you should always sort the internal table before using DELETE ADJACENT DUPLICATES, as otherwise you may not get the appropriate result you want, if the table is not sorted then after using DELETE ADJACENT DUPLICATES also there might be duplicate records left, so to be sure that all the duplicate records have been deleted you should use sort.
With regards,
Pritam