‎2007 Feb 06 8:13 PM
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
‎2007 Feb 06 8:16 PM
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
‎2007 Feb 06 8:16 PM
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
‎2007 Feb 06 9:33 PM
HI,
Its giving me ALIAS name table error..
Is there any thing I can do..?
Any help would be appreciated.
Thanks,
Raj
‎2007 Feb 06 9:09 PM
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