Inner joins using 3 tables
Try this :-
SELECT stpo~stlnr stpo~idnrk mast~matnr mara~mtart stpo~menge
INTO CORRESPONDING FIELDS OF TABLE zmat1 FROM mast
JOIN stpo ON stpo~stlnr = mast~stlnr
JOIN mara ON mara~matnr = mast~matnr
WHERE stpo~stlty = 'M' "AND stpo~idnrk IN s_matnr
AND mast~werks = 1000.
Here s_matnr is a select-options on the selection-screen.
Or this.
Code:
Select single Vbrk~Bukrs Vbrk~Kunrg
Vbrk~Vbeln
Vbrk~Fkdat Vbrk~Bstnk_Vf Vbrk~Zterm
Tvzbt~Vtext
Vbak~Vbeln Vbak~Bstdk
Likp~Vbeln Likp~lfdat Likp~Lfuhr
into w_vbrk
from vbrk
inner join
Tvzbt on Tvzbt~Zterm = Vbrk~Zterm
and
Tvzbt~Spras = sy-langu
Inner join
Vbfa as SalesLnk
on SalesLnk~vbeln = pu_vbeln
and
SalesLnk~vbtyp_v = c_order
inner join Vbak on Vbak~Vbeln
= SalesLnk~Vbelv
Inner join
Vbfa as DeliveryLnk
on DeliveryLnk~vbeln = pu_vbeln
and
DeliveryLnk~vbtyp_v = c_Delivery
inner join Likp on Likp~Vbeln
= DeliveryLnk~Vbelv
where vbrk~vbeln = pu_Vbeln.
This code locates sales, delivery and payment terms info
from a billing document number.
or
Here, this one also works fine :
select zfpcd~cadivi zfpcd~proforma zfpcd~factura zfpcd~aniofactura
zfpcd~montousd zfpcd~montoap zfpcd~ebeln zfpcd~inco1
zfpcd~lifnr lfa1~name1 zcdvs~status zfpcd~conint
into it_lista
from zfpcd inner join zcdvs
on zfpcd~ebeln = zcdvs~ebeln
and zfpcd~proforma = zcdvs~proforma
and zfpcd~lifnr = zcdvs~lifnr
inner join lfa1
on zfpcd~lifnr = lfa1~lifnr
where zcdvs~status = '04'.
Related ABAP Topics:
Table
CDHDR and CDPOS Usage
Get help for your ABAP problems
Do you have
a ABAP Question?
SAP Books
SAP Certification,
Interview Questions, Functional, Basis Administration and ABAP Programming
Reference Books
More ABAP Tips
Main Index
SAP ERP Modules,
Basis, ABAP and Other IMG Stuff
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
All product names are trademarks of their respective
companies. The site www.erpgreat.com is in no way affiliated with
SAP AG.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
The content on this site may not be reproduced
or redistributed without the express written permission of
www.erpgreat.com or the content authors.
|