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

Join Statement require

former_member764673
Participant
0 Likes
557

I have three tables..

ZGMARD

EQUI

EQBS

<u>ZGMARD tables has</u>

MATNR

WERKS

LGORT

<u>EQUI table has</u>

EQUNR

MATNR

SERGE

<u>EQBS table has</u>

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
477

HI,

Check this..

i see u dont need to have EQBS table in join to get SERGE values.. any way i coded with EQBS... if u feel u dont need u can take it out..

assume u defined internal table with those fields.

SELECT ZGMARDMATNR ZGMARDLGORT EQUIEQUNR EQUISERGE EQBSWERKS INTO CORRESPONDING FIELDS OF TABLE ITAB FROM ZGMARD INNER JOIN EQUI ON ZGMARDMATNR = EQUIMATNR INNER JOIN EQBS ON EQUIEQUNR = EQBSEQUNR WHERE ZGMARDMATNR IN SO_MATNR AND EQBS~WERKS IN SO_WERKS.

SO_MATNR and SO_WERKS are select-options or parameters in selection screen. Provide some more condition in where clause for performace issue.

u can add more conditions according to ur requirement.

Regards

SAB

3 REPLIES 3
Read only

Former Member
0 Likes
478

HI,

Check this..

i see u dont need to have EQBS table in join to get SERGE values.. any way i coded with EQBS... if u feel u dont need u can take it out..

assume u defined internal table with those fields.

SELECT ZGMARDMATNR ZGMARDLGORT EQUIEQUNR EQUISERGE EQBSWERKS INTO CORRESPONDING FIELDS OF TABLE ITAB FROM ZGMARD INNER JOIN EQUI ON ZGMARDMATNR = EQUIMATNR INNER JOIN EQBS ON EQUIEQUNR = EQBSEQUNR WHERE ZGMARDMATNR IN SO_MATNR AND EQBS~WERKS IN SO_WERKS.

SO_MATNR and SO_WERKS are select-options or parameters in selection screen. Provide some more condition in where clause for performace issue.

u can add more conditions according to ur requirement.

Regards

SAB

Read only

0 Likes
477

HI,

Its giving me ALIAS name table error..

Is there any thing I can do..?

Any help would be appreciated.

Thanks,

Raj

Read only

Former Member
0 Likes
477

Hi,

In real time generally we avoid the use of Inner Joins because of Performance Issue. Istead of joins you can go for SELECT FOR ALL ENTRIES.

Ashvender