Application Development 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: 

syntax error

Former Member
0 Kudos
4,399

Hi,

I am working on report.

while using innerjoin i am getting error like

"The column name "EBELN" has two meanings.ABAP/4 OPEN SQL statement.

my code is

-


SELECT aebeln absart aekgrp abedat a~waers

aekorg alifnr areswk bebelp b~matnr

btxz01 bmatkl

bloekz bpstyp bknttp bwerks

blgort bmenge bmeins bnetpr

bpeinh bbednr bbanfn bbnfpo

cmenge cwemng c~eindt

FROM ( ( ekko AS a

INNER JOIN ekpo AS b ON aebeln = bebeln )

INNER JOIN eket AS c ON aebeln = cebeln AND

bebelp = cebelp )

INTO TABLE it_orders

WHERE ebeln IN s_ebeln AND

ekorg IN s_ekorg AND

bsart IN s_bsart AND

ekgrp IN s_ekgrp AND

  • bedat IN s_bedat AND

lifnr IN s_lifnr AND

  • ebeln IN s_ebeln AND

werks IN s_werks AND

pstyp IN s_pstyp AND

knttp IN s_knttp AND

matnr IN s_matnr AND

txz01 IN s_txz01 AND

matkl IN s_matkl AND

bednr IN s_bednr AND

elikz EQ space. "AND

  • loekz EQ space.

-


please solve my problem SSM.

Aruna

5 REPLIES 5

former_member583013
Active Contributor
0 Kudos
731

SELECT a~ebeln a~bsart a~ekgrp a~bedat a~waers
a~ekorg a~lifnr a~reswk b~ebelp b~matnr
b~txz01 b~matkl
b~loekz b~pstyp b~knttp b~werks
b~lgort b~menge b~meins b~netpr
b~peinh b~bednr b~banfn b~bnfpo
c~menge c~wemng c~eindt
FROM ( ( ekko AS a
INNER JOIN ekpo AS b ON a~ebeln = b~ebeln )
INNER JOIN eket AS c ON a~ebeln = c~ebeln AND
b~ebelp = c~ebelp )
INTO TABLE it_orders
WHERE ebeln IN s_ebeln AND
ekorg IN s_ekorg AND
bsart IN s_bsart AND
ekgrp IN s_ekgrp AND
* bedat IN s_bedat AND
lifnr IN s_lifnr AND
a~ebeln IN s_ebeln AND
werks IN s_werks AND
pstyp IN s_pstyp AND
knttp IN s_knttp AND
matnr IN s_matnr AND
txz01 IN s_txz01 AND
matkl IN s_matkl AND
bednr IN s_bednr AND
elikz EQ space. "AND
* loekz EQ space.

It must be like a~ebeln

Greeting,

Blag.

Former Member
0 Kudos
731

EBELN exists on more that one table so the error is stating that the sql does not know which table to you.

You need to do this.

Where a~ebeln eq .....

Former Member
0 Kudos
731

Hello,

Make the change like this.


SELECT a~ebeln a~bsart a~ekgrp a~bedat a~waers
a~ekorg a~lifnr a~reswk b~ebelp b~matnr
b~txz01 b~matkl
b~loekz b~pstyp b~knttp b~werks
b~lgort b~menge b~meins b~netpr
b~peinh b~bednr b~banfn b~bnfpo
c~menge c~wemng c~eindt
FROM ( ( ekko AS a
INNER JOIN ekpo AS b ON a~ebeln = b~ebeln )
INNER JOIN eket AS c ON a~ebeln = c~ebeln AND
b~ebelp = c~ebelp )
INTO TABLE it_orders
WHERE a~ebeln IN s_ebeln AND
a~ekorg IN s_ekorg AND
a~bsart IN s_bsart AND
a~ekgrp IN s_ekgrp AND
* bedat IN s_bedat AND
lifnr IN s_lifnr AND
* ebeln IN s_ebeln AND
b~werks IN s_werks AND
b~pstyp IN s_pstyp AND
b~knttp IN s_knttp AND
b~matnr IN s_matnr AND
b~txz01 IN s_txz01 AND
b~matkl IN s_matkl AND
b~bednr IN s_bednr AND
b~elikz EQ space. "AND
* loekz EQ space.

Cheers,

Vasanth

Former Member
0 Kudos
731

SELECT a~ebeln a~bsart a~ekgrp a~bedat a~waers
a~ekorg a~lifnr a~reswk b~ebelp b~matnr
b~txz01 b~matkl
b~loekz b~pstyp b~knttp b~werks
b~lgort b~menge b~meins b~netpr
b~peinh b~bednr b~banfn b~bnfpo
c~menge c~wemng c~eindt
FROM ( ( ekko AS a
INNER JOIN ekpo AS b ON a~ebeln = b~ebeln )
INNER JOIN eket AS c ON a~ebeln = c~ebeln AND
b~ebelp = c~ebelp )
INTO TABLE it_orders
WHERE a~ebeln IN s_ebeln AND
a~ekorg IN s_ekorg AND
a~bsart IN s_bsart AND
a~ekgrp IN s_ekgrp AND
* bedat IN s_bedat AND
a~lifnr IN s_lifnr AND
* ebeln IN s_ebeln AND
b~werks IN s_werks AND
b~pstyp IN s_pstyp AND
b~knttp IN s_knttp AND
b~matnr IN s_matnr AND
b~txz01 IN s_txz01 AND
b~matkl IN s_matkl AND
b~bednr IN s_bednr AND
elikz EQ space. "AND
* loekz EQ space.

You forgot to add wich table belongs each field in the where condition

Former Member
0 Kudos
731

in the where condition specify as a~ebeln.

regards,

venkat.