03-25-2015 4:57 PM
I
I'm doing an abap query in SQ02 with LIKP and LIPS tables.
As output I just want lines with different entries in LIPS of material.
How can I delete the duplicates? With instruction delete ADJACENT DUPLICATES FROM XXXX COMPARING vbeln matnr, how can I identity the table?
Thanks
Dora
03-26-2015 3:25 PM
Hello Dora,
It is a very well known difficult task to use 'Delete Adjacent Duplicates' syntax in Infoset Query because of the fact that you are not aware of the internal table.
Two methods to address this:
1. Study the repeating lines and use another suitable join in the tables manually, which can eliminate the undesirable duplicates.
2. The other one I always practiced was, Study all fields of the repeating lines. Identify at least one the field value which is not same in these duplicate lines. Suppose you have a field ABCD and values X in one and Y in other. And you have decided to have the lines with value X. Then give the following syntax in the Record Processing section of SQ02.
CHECK TABLE-ABCD = 'X'.
This would remove the lines with Y.
KJogeswaraRao
03-25-2015 7:05 PM
First of all why duplicate comes, did you check the query input parameters?
If you still want to add coding, then put your question in ABAP forum for answers.
Regards,
03-25-2015 8:34 PM
Hi Dora
For removing duplicate you need to fetch data into some internal table and then apply
delete adjacent clause.
Syntax for this
DELETE ADJACENT DUPLICATES FROM itab comparing f1 f2 f3.
Here f1 f2 and f3 are list of fields.
Thanks,
Neha
03-26-2015 1:04 PM
03-26-2015 3:25 PM
Hello Dora,
It is a very well known difficult task to use 'Delete Adjacent Duplicates' syntax in Infoset Query because of the fact that you are not aware of the internal table.
Two methods to address this:
1. Study the repeating lines and use another suitable join in the tables manually, which can eliminate the undesirable duplicates.
2. The other one I always practiced was, Study all fields of the repeating lines. Identify at least one the field value which is not same in these duplicate lines. Suppose you have a field ABCD and values X in one and Y in other. And you have decided to have the lines with value X. Then give the following syntax in the Record Processing section of SQ02.
CHECK TABLE-ABCD = 'X'.
This would remove the lines with Y.
KJogeswaraRao
03-26-2015 6:06 PM
Hi, thanks for your answer.
The good of your answer is that now I know that this is not a simple question.
I can do sort the data before the Record Processing?
Thanks
Dora
03-26-2015 9:53 PM
Again, the internal table figures in your question. So the answer is 'No'.
03-27-2015 9:59 AM
Hi, my problem is that:
I have an header table and an item table.
I want the output with just 1 line for each entry for document/material.
EX: Doc A - Material 1
Doc A - Material 2
Doc A - Material 1
I want the output with just 2 lines:
Doc A - Material 1
Doc A - Material 2
I can stay with the last document/material and compare and if is the next is the same I can make a ' check ' as you say.
But if the lines don't came in order this is not going to work.
There are any way of compare with the lines that as already been process?
Thanks
Dora
04-29-2015 10:14 AM
The solutions for the problem:
I create an internal table.
Then with an additional field I verify if that record already exists. Then I check if doesn't exists inserts in the internal table.