2006 Jul 22 9:34 AM
Hi all,
How to delete duplicate records of p.o. while checking with kunnr, vkorg, vtweg, bstkd, bstdk respectively.
Do the Needful.
Thanks in advance
Venkat
Hi all,
How to delete duplicate records of p.o. while checking with kunnr, vkorg, vtweg, bstkd, bstdk respectively.
Do the Needful.
Thanks in advance
Venkat
2006 Jul 22 9:36 AM
Hi,
if your data is in a internal table i_tab , then sort and use the below statement :
sort i_tab by kunnr vkorg vtweg bstkd bstdk
delete adjacent duplicates from i_tab comparing kunnr vkorg vtweg bstkd bstdk
syntax :
Extras:
1. ... COMPARING f1 f2 ...
2. ... COMPARING ALL FIELDS
Effect
Deletes adjacent duplicate entries from the internal table itab. If there are n duplicate entries in succession, the first entry is retained, and the following n-1 entries are deleted.
Two lines are regarded as duplicates if their keys are identical.
The Return Code is set as follows:
SY-SUBRC = 0:
At least one duplicate was found, and at least one entry was deleted.
SY-SUBRC = 4:
No duplicates found, no entries deleted.
Addition 1
... COMPARING f1 f2 ...
Effect
Two lines of the internal table itab are regarded as duplicates if they have identical contents in the fields f1, f2, ...
Addition 2
... COMPARING ALL FIELDS
Effect
Two lines of the internal table are regarded as duplicates if all of their field contents are identical.
Regards
appana
2006 Jul 22 9:37 AM
Hi,
Just sort the internal table and then use the statement delete adjacent from itab comparing field names...
sorting is must...
Cheers,
Simha.
2006 Jul 22 9:38 AM
<b>Deleting Adjacent Duplicate Entries</b>
To delete adjacent duplicate entries use the following statement:
DELETE ADJACENT DUPLICATE ENTRIES FROM <itab>
[COMPARING <f1> <f 2> ...
|ALL FIELDS].
So you can try as
DELETE ADJACENT DUPLICATE ENTRIES FROM ITAB COMPARING KUNNR VKORG VTWEG BSTKD BSTDK.
Go thhru this link
http://help.sap.com/saphelp_47x200/helpdata/en/06/aafd54fc4011d195280000e8353423/frameset.htm
Regds
Manohar
2006 Jul 22 9:52 AM
Hi Venkat,
Before deleting duplicate records, sort the internal table according to your needs. What fields you are going to sort.
Then user adjacent duplicates statement.
Regards
Arun
2006 Jul 22 1:55 PM
Hi Venkat,
First you sort your internal table by kunnr, vkorg, vtweg, bstkd, bstdk
then use the following syntax
DELETE ADJACENT DUPLICATE ENTRIES FROM <itab>
[COMPARING <f1> <f2> |ALL FIELDS].
Giridhar..
2006 Jul 24 5:29 AM
HAI,
to delete duplicate records.i suppose there are you ways.
One: not to select the duplicate records .for that use the key word DISTINCT for selecting multiple records.it will not select duplicate records.
Two:select all the records into a internal table.sort it ,then use 'DELETE ADJECENT DUPLICATES'.
please award points if it meets your requirement.
thank you.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |