Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Inner Join Select query

hello all,

Below is a inner join query

SELECT aebeln aebelp apackno bzekkn b~ps_psp_pnr

FROM ( ( ekpo AS a INNER JOIN ekkn AS b

ON aebeln = bebeln

AND aebelp = bebelp )

INNER JOIN prps AS c

ON bps_psp_pnr = cpspnr )

INTO TABLE t_wbspo

WHERE a~ebeln IN s_ebeln

AND c~psphi IN s_psphi

AND stufe = c_task.

I want to modify this select and put one more join on ekkn-aufnr

and aufk-afunr .

Now for this i write the below code

SELECT aebeln aebelp apackno bzekkn bps_psp_pnr baufnr

FROM ( ( ( ekpo AS a INNER JOIN ekkn AS b

ON aebeln = bebeln

AND aebelp = bebelp )

INNER JOIN prps AS c

ON bps_psp_pnr = cpspnr )

INNER JOIN aufk AS d

ON baufnr = daufnr )

INTO TABLE t_wbspo

WHERE a~ebeln IN s_ebeln

AND c~psphi IN s_psphi

AND d~aufnr IN s_aufnr

AND stufe = c_task.

By the above way does it puts a join on ekkn-aufnr and aufk-aufnr ?

Is the above way the right way to do it ?

Please confirm

regards

Tags:
Not what you were looking for? View more on this topic or Ask a question