06-16-2008 8:04 PM
Hi there
I am using the following 2 lines of code to omit duplicate lines from my data is there are more than 1 matnrs.
sort part_data by matnr.
delete ADJACENT DUPLICATES FROM part_data COMPARING matnr.
The trouble is, this seems to stop 3 of my columns from displaying the values. Stock_days and stock_months both show as 0.
If I used COMPARING ALL FIELDS instead, does this mean that the code would show lines with stock_days and stock_months if they have a value greater than zero but one line per each matnr.
06-16-2008 8:07 PM
Hi,
Use
delete ADJACENT DUPLICATES FROM part_data.
This will compare all the fields.
Thanks
Vikranth
06-16-2008 8:07 PM
Hello
If you use COMPARING ALL FIELDS will delete the lines that have the same content, not the ones that have greater or less value than zero...
Bye
Gabriel P.
06-16-2008 8:08 PM
hi Katie,
This is how delete adjacent duplicates work for a general scenario ...
DELETE ADJACENT DUPLICATES FROM itab.
Additions
1. ... COMPARING f1 f2 ...
2. ... COMPARING ALL FIELDS
Effect
Deletes neighboring, duplicate entries from the internal table itab . If there are n duplicate entries, the first entry is retained and the other n - 1 entries are deleted.
Two lines are considered to be duplicated if their default keys match.
The return code value is set as follows:
SY-SUBRC = 0 At least one duplicate exists, at least one entry deleted.
SY_SUBRC = 4 No duplicates exist, no entry deleted.
Addition 1
... COMPARING f1 f2 ...
Effect
Two lines of the internal table itab are considered to be duplicates if the specified fields f1 , f2 , .... match.
Addition 2
... COMPARING ALL FIELDS
Effect
Two lines are considered to be duplicates if all fields of the table entries match.
Regards,
Santosh
06-16-2008 10:46 PM
You can use the following -
sort itab.
delete adjacent duplicates from itab comparing all fields.
award me points if it helps.
Thanks,
Sheel