04-13-2006 5:21 PM - last edited on 02-04-2024 5:33 AM by postmig_api_4
Hi,
How do I delete duplicate entries from an Standard View in an Abap Code?
Thanks,
Pravs
04-13-2006 6:19 PM
Then it becomes complicated. Are you trying to delete the duplicates from a view? Then look at your view definition and see if you can avoid duplicates by changing its selection criteria. Also take note of Rob's comment.
If you are trying to delete from a database table as opposed to a view, then I don't know how you achieved the feat of having duplicate entries as any duplicate inserts with same key fields would have resulted in dump. Can you please clarify?
04-13-2006 5:25 PM
Are you pulling the entries into an internal table or do you want to delete them on the db table itself? If you want to achieve this in the internal table, then you can use
SORT itab BY keyfields.
DELETE ADJACENT DUPLICATES FROM itab COMPARING keyfields(or ALL FIELDS)
04-13-2006 5:29 PM
Hi Srinivas,
I want to delete the duplicate entries from the Database not from the Internal table.
04-13-2006 5:46 PM
Hi,
populate itab (internal table) with the entries u want to delete from db view. then use
DELETE dbtab FROM TABLE itab
(dbtab = db view name)
04-13-2006 5:51 PM
According to the help for SELECT:
You can delete data using a view only if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status "No restriction".
Rob
04-13-2006 6:19 PM
Then it becomes complicated. Are you trying to delete the duplicates from a view? Then look at your view definition and see if you can avoid duplicates by changing its selection criteria. Also take note of Rob's comment.
If you are trying to delete from a database table as opposed to a view, then I don't know how you achieved the feat of having duplicate entries as any duplicate inserts with same key fields would have resulted in dump. Can you please clarify?