11-12-2011 9:13 AM
Dear Experts,
When I join table VBAK and AUFK in SQVI, I am not getting any result. The join condition is proposed by the system. (field AUFNR in VBAK and AUFK).
I tried debugging SQVI, and I found these lines of codes:
open cursor with hold %dbcursor for
select VBAKVBELN AUFKAUFNR
from ( VBAK
inner join AUFK
on AUFKAUFNR = VBAKAUFNR )
where AUFK~AUFNR in SP$00001 .
It seems the system does not get any result from executing it. I tried to write a simple ABAP code similar to it like this:
select VBAK~VBELN
from ( VBAK
inner join AUFK
on AUFKAUFNR = VBAKAUFNR )
into corresponding fields of table it_aufk
where AUFK~AUFNR in S_AUFNR.
Again, I am not getting any result from it as well.
Would you please suggest how to make my query in SQVI works?
11-12-2011 12:39 PM
AUFK stores process orders in PP-PI module. A process order may not always be linked to a Sales document in SD module. If it is linked then the linking is as follow
AUFK-KDAUF = VBAP-VBELN
AUFK-KDPOS = VBAP-POSNR
OR
AUFK-KDAUF = VBAK-VBELN
The join should be with AUFK as leading table and VBAK or VBAP as the second table, as KDAUF is not a key field in AUFK. If you keep VBAK or VBAP as leading table the query will be very slow
11-12-2011 9:57 AM
11-12-2011 12:39 PM
AUFK stores process orders in PP-PI module. A process order may not always be linked to a Sales document in SD module. If it is linked then the linking is as follow
AUFK-KDAUF = VBAP-VBELN
AUFK-KDPOS = VBAP-POSNR
OR
AUFK-KDAUF = VBAK-VBELN
The join should be with AUFK as leading table and VBAK or VBAP as the second table, as KDAUF is not a key field in AUFK. If you keep VBAK or VBAP as leading table the query will be very slow
11-13-2011 3:32 AM
Dear Vishnu Tallapragada,
Thank you for you reply.
In my case, this is a relationship between CS - Service Order and SD - Sales Order. I can see in SE11 or SE16 that VBAK-AUFNR = AUFK-AUFNR.; however, when using SQVI or inner join, I am not getting any result.
In addition, in my case, the field KDAUF and KDPOS are blank even though a sales order is created as a subsequent document.
---
Dear rakibuddala,
Would you please elaborate? like the field from which table? I cannot find it in both AUFK and VBAK.