cancel
Showing results for 
Search instead for 
Did you mean: 

Query on joint SD-tables

0 Kudos

Dear experts,

I am trying to create a query with SQVI with different tables, but it does not seem to work correctly.

I have linked VBAK with 3 tables

Links:

Left: VBAK-VBELN

Right: VBAK-VBELN(2)

Jointype: Left Outer

Left: VBAK-VBELN

Right: VBAP-VBELN(3)

Jointype: Left Outer

Left: VBAK-VBELN

Right: LIPS-VGBEL

Jointype: Left Outer

Then I linked the LIPS table to the LIKP table:

Link:

Left: LIPS-VBELN

Right: LIKP-VBELN(2)

Jointyp: Inner

The query is working, but only displays sales orders which have already a delivery linked to it. What we need is that all the sales orders are displayed (also when a delivery has not been created).

Can anyone help me with this problem? Will reward points!

Kind regards,

Tim

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try linking VBAK & LIKP / LIPS through table VBFA. VBFA is table for linking Document Flow.

Also refer to link below:

Link: http://www.sap-img.com/

Topic: Free ABAP eBook Download

SAP MM, SD, FI, PS, PP, PM, HR, System Tables

(refer to SD Tables)

Regards,

Rajesh Banka

Reward points if helpful.

Answers (3)

Answers (3)

Lakshmipathi
Active Contributor
0 Kudos

Dear Tim

May be first you can try with VA05 through which you will get all sale orders.

Then go to SE16 / LIPS, so that you will get list of delivery documents where you can find the sale order reference also under "Reference Doc".

thanks

G. Lakshmipathi

Former Member
0 Kudos

Customer master to sales order sold-to party

KNA1-KUNNR = VBAK-KUNNR.

Sales order line item to delivery.

LIPS-VGBEL = VBAK-VBELN

LIPS-VGPOS = VBAP-POSNR.

Billing document line item to delivery

VBRP-VGBEL = LIPS-VBELN.

VBRP-VGPOS = LIPS-POSNR.

Billing document to accounting document.

VBRK-VBELN = BKPF-AWKEY & BKPF-AWTYP = 'VBRK'

Regards,

Rajesh Banka

Former Member
0 Kudos

The way join works is that it would keep joining tables in sequence. The join you are doing is not working because of inner join between LIPS and LIKP. If you are not really interested in data from LIKP, take it out. and it will work for you.

Problem is where it doesn't find entry in LIPS, it goes fine since it is a outer join with VBAP but then, it has inner join with LIKP causing issues. You can only have one outer join on a table at any time, so it wont work for you. Working with VBFA may not help you also in Query using join data source since for no delivery or no flow, no record is present in VBFA also.

Perhaps ABAP code can help you out here. Let me know if you need some code.

Award points if helpful.

0 Kudos

Thanks for your input,

I am afraid Shiv's answer is correct, we will need a piece of ABAP code.

Regards,

Tim

PS points given