‎2007 Feb 06 9:54 PM
I have three tables..
ZGMARD
EQUI
EQBS
ZGMARD tables has
MATNR
WERKS
LGORT
EQUI table has
EQUNR
MATNR
SERGE
EQBS table has
EQUNR
WERKS
PLANT
Now my requirement is I need a join statement where
dependeding on MATNR,WERKS and LGORT from ZGMARD I should be able to get the SERGE.(depending on tables EQUI and EQBS)
Any help would be appreciated.
Thanks,
Raj
‎2007 Feb 06 10:39 PM
Hi,
Select matnr werks lgort into table i_zgmard from zgmard
where matnr in s_matnr
and werks in s_werks
and lgort in s_lgort.
select aequnr amatnr aserge bB_WERK
into table i_equi from equi as a inner join eqbs as b
for all entries in i_zgmard
where a~matnr = i_zgmard-matnr
and b~b_werk = i_zgmard-werks.
Assuming matnr, werks and lgort to be select-options. In eqbx table plant is B_WERK.
Regards
Subramanian
‎2007 Feb 06 10:48 PM
hi raj,
Try the following stmt. In the below stmt I used both joins as inner joins. you can also use outer joins in their place. Here itab is an internal table with only one field serge. If you want additional fields also along with serge, define them in the internal table and specify them in the select statement from which table u want which field as i done it for serge.
select equiserge from equi inner join zgmard on equimatnr = zgmardmatnr inner join eqbs on zgmardwerks = eqbs~werks into table itab.
regards,
rajasekhar.k