Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Inner and outer Join statement

former_member764673
Participant
0 Likes
408

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

2 REPLIES 2
Read only

Former Member
0 Likes
352

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

Read only

Former Member
0 Likes
352

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