cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate rows in SAP Query

samjalees2000
Participant
0 Kudos

Now here is the issue.

FIrst of all I am using sap query for generating a report.There are such reports where we require to know deliveries corresponding to sales orders.So in the infoset we have to join the tables *vbak-vbap-lips-likp". Now in the report output we will find duplicate records for a single order(400000001) delivery relation(9000000002) such as:

Sale Order Delivery

400000001 9000000002

400000001 9000000002

400000001 9000000002

This is due to three items in between them.Now how can we handle this situation as we know there is not duplicate records in the infoset but there duplicate records in the output.I hope you get my point.Please reply urgently

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

in the join of the tables VBAK VBAP LIKP LIPS and you look for item detailes, are you considering the item number POSNR as key also?

Try to consider also the folliwing tables:

1. VBAK (get the order list)

2. VBAP (get the item details of the order) and keep truck of the POSNR

3. check the subsequent documents in VBFA (you enter with result of VBAP [VBELV & POSNV] and you end/take the follow-on document and item number = VBELN & POSNN)

4. LIKP (get the information of the delivery header = you enter with the result at point 3 VBELN)

5. LIPS (get the information of the item of the delivery = you enter with VBELN & POSNN got at point 3)

Do not forget to query and have POSNR as key since the beginning.

Regards,

Answers (2)

Answers (2)

samjalees2000
Participant
0 Kudos

Here it is,

vbap (sales document number,item number) == vbfa(( preceding document number,preceding item number)

lips (delivery number,item number) == vbfa( subsequent document number,subsequent item number)

By the way vbfa doesn't make such difference as it also links through items :S .Is there anyway we can remove duplicates from the output without distubing the infoset.

Edited by: Sam Ahmed on Jul 8, 2010 3:29 PM

samjalees2000
Participant
0 Kudos

I appreciate your answer but I have already used posnr as one of the keys .Logically speaking the records will still be duplicated as posnr is nothing just the item number of the material .So it will still produce duplicate records for multiple items connecting vbap and lips.

Former Member
0 Kudos

Hello,

which relation di you create between the tables?

one VBAK presents many VBAP (key only sales doc)

one VBAP presents one VBAK (key only sales doc)

one VBAP presents from 0 to many VBFA (key both sales doc & item nr)

one VBFA presents one VBAP (key both sales doc & item nr)

one VBFA presents one LIPS (key both follow-on doc & item nr)

one LIPS presents one VBFA (key both follow-on doc & item nr)

one LIPS presents one LIKP (key only delivery doc)

one LIKP presents many LIPS (key only delivery doc)

Regards,