‎2008 Jan 27 5:01 AM
want to delete all occurances (not just the adjacent duplicates) from an internal table where certain fields are duplicated.
I tried 'DELETE duplicate entries FROM it_name' but got an error saying 'Between Delete and Duplicate, Adjacent is missing'.
Anyone know how I can do this?
‎2008 Jan 27 5:48 AM
Hi Venkat,
see this code.
u can delete duplicates from ur records like this.
DATA: BEGIN OF connection,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
distid TYPE spfli-distid,
distance TYPE spfli-distance,
END OF connection.
DATA connection_tab LIKE SORTED TABLE OF connection
WITH NON-UNIQUE KEY cityfrom cityto
distid distance.
SELECT cityfrom cityto distid distance
FROM spfli
INTO TABLE connection_tab.
DELETE ADJACENT DUPLICATES FROM connection_tab.
kindly reward if found helpful.
cheers.
hema.
‎2008 Jan 27 5:08 AM
Hi Venkat
try this
sort table it_name by f1 f2.
delete adjacent duplicates from it_name comparing F1 F2.
Award points for helpful answers
Edited by: Jackandjay on Jan 27, 2008 12:21 AM
‎2008 Jan 27 5:17 AM
Hi,
Before using Delete adjacent duplicates key word...You need to sort the itab..(internal table)..
SORT ITAB BY FIELD.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING FIELD.
‎2008 Jan 27 5:48 AM
Hi Venkat,
see this code.
u can delete duplicates from ur records like this.
DATA: BEGIN OF connection,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
distid TYPE spfli-distid,
distance TYPE spfli-distance,
END OF connection.
DATA connection_tab LIKE SORTED TABLE OF connection
WITH NON-UNIQUE KEY cityfrom cityto
distid distance.
SELECT cityfrom cityto distid distance
FROM spfli
INTO TABLE connection_tab.
DELETE ADJACENT DUPLICATES FROM connection_tab.
kindly reward if found helpful.
cheers.
hema.
‎2008 Jan 27 8:27 AM
it is "delete adjacent duplicates from itab comparing all fields
Edited by: Satish Kumar NRB on Jan 27, 2008 9:27 AM
‎2008 Jan 27 8:27 AM
it is "delete adjacent duplicates from itab comparing all fields
Cheers,
satish