‎2007 May 14 5:52 AM
Hi All,
I have written an inner join statement as given below but it is giving an error "LOEKZ has two meanings".what could be wrong?
SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ
aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU
aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL
into corresponding fields of table t_eban
from EBAN as a inner join ebkn as b
on abanfn = bbanfn
AND abnfpo = bbnfpo
where flief eq flief
and kostl eq b~kostl
and LOEKZ NE 'X'.
Thanks,
Rakesh More.
‎2007 May 14 5:56 AM
Hi
Hi in the where condn you have say LOEKZ field is from EBAN or from EBKN tables. write accordingly a or b with field like below:
SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ
aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU
aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL
into corresponding fields of table t_eban
from EBAN as a inner join ebkn as b
on abanfn = bbanfn
AND abnfpo = bbnfpo
where flief eq flief
and akostl eq bkostl
and a~LOEKZ NE 'X'.
Reward points if useful
Regards
Anji
‎2007 May 14 5:56 AM
Hi
Hi in the where condn you have say LOEKZ field is from EBAN or from EBKN tables. write accordingly a or b with field like below:
SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ
aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU
aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL
into corresponding fields of table t_eban
from EBAN as a inner join ebkn as b
on abanfn = bbanfn
AND abnfpo = bbnfpo
where flief eq flief
and akostl eq bkostl
and a~LOEKZ NE 'X'.
Reward points if useful
Regards
Anji
‎2007 May 14 5:57 AM
See the below code :
SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ
aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU
aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL
into corresponding fields of table t_eban
from EBAN as a inner join ebkn as b
on abanfn = bbanfn
AND abnfpo = bbnfpo
where aflief eq bflief
and akostl eq bkostl
and a~LOEKZ NE 'X'.
Reward Points if it is useful
Thanks
Seshu
‎2007 May 14 5:57 AM
Hi Rakesh,
Instead of just giving LOEKZ. Write it as aLOEKZ 'OR" bLOEKZ. The error is because of ambiguity as LOEKZ is there in both EBAN & EBKN.
Regards,
Younus
Reward Helpful Answers!!!!
‎2007 May 14 5:57 AM
‎2007 May 14 5:57 AM
hi
it means that the field used in where clause is existing in more than one table that you have used in your select statement...so you have to specify which table's LOEKZ in your select statement...change it as follows
SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ
aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU
aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL
into corresponding fields of table t_eban
from EBAN as a inner join ebkn as b
on abanfn = bbanfn
AND abnfpo = bbnfpo
where flief eq flief
and kostl eq b~kostl
and aLOEKZ NE 'X'. --> specifies eban's loekz or bloekz - ebkn's loekz
if helpful, reward
Sathish. R
‎2007 May 14 5:57 AM
Hi,
This is because the field LOEKZ is there in both the tables , u have to give as a~LOEKZ in where condition.
Regards,
Sonika
‎2007 May 14 6:00 AM
Hi Rakesh,
U have to take this condition also :
<b> aLOEKZ = BLOEKZ</b>
Use this code :
SELECT aBANFN aBNFPO aWERKS aEKGRP aMATNR aTXZ01 aERNAM aFRGKZ
aFRGDT aFRGST aBADAT aERDAT aEBELN aEBELP aBEDAT aSTATU
aMATKL aBEDNR aBSART aAFNAM aBSTYP aFLIEF b~KOSTL
into corresponding fields of table t_eban
from EBAN as a inner join ebkn as b
on abanfn = bbanfn
AND abnfpo = bbnfpo
<b>AND aLOEKZ = BLOEKZ</b>
where flief eq flief
and kostl eq b~kostl
and LOEKZ NE 'X'.
Reward points if helpful.
Regards,
Hemant