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

Syntax Error!

Former Member
0 Likes
967

Hi,

i had written the code as follows:

loop at it_rkwa.

select ekorg ekgrp

from eine as a

inner join eine as b on ainfnr = binfnr

where

matnr = it_rkwa-matnr_rkwa

and lifnr = it_rkwa-lifnr_rkwa.

endif.

append it_rkwa.

clear it_rkwa.

endloop.

when i check it for syntax for consistency it throws me the following error:

"the column name 'EKORG ' has two meanings: ABAP/4 open SQL statement "

Can any body here tell me what could be the problem?

Thanks,

Ravi

7 REPLIES 7
Read only

Former Member
0 Likes
883

You are doing an INNER JOIN on the same table

from eine as a

inner join eine as b

INNER JOINs are for joining different tables not the same table.

Read only

Former Member
0 Likes
883

loop at it_rkwa.

select <b>aekorg aekgrp</b>

from eine as a

inner join eine as b on ainfnr = binfnr

where

matnr = it_rkwa-matnr_rkwa

and lifnr = it_rkwa-lifnr_rkwa.

endif.

append it_rkwa.

clear it_rkwa.

endloop.

Please modify the code in the high lighted part.

Regards,

Pavan

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
883

Make sure you use the labels for the fields in the field list.

select a~ekorg a~ekgrp     "<--  RIGHT HERE
from eine as a
inner join eine as b on a~infnr = b~infnr
where
matnr = it_rkwa-matnr_rkwa
and lifnr = it_rkwa-lifnr_rkwa.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
883

Re-write your code as below.

if not it_rkwa[] is initial.
select ekorg ekgrp
from eine 
into corresponding fields of table it_rkwa2
for all entries in it_rkwa
where matnr = it_rkwa-matnr_rkwa
and lifnr = it_rkwa-lifnr_rkwa.
endif.

Please mark points if the solution was useful.

Regards,

Manoj

Read only

Former Member
0 Likes
883

Hi,

Check this link....

change u r select according to that..

reward if it helps..

regards,

Omakr.

Read only

Former Member
0 Likes
883

Hi,

y r u joining the same table...??

We will generally get that error because when we are joining two tables and writing a condition on particular field which is PRESENT in both the tables then it will be giving that error. To avoid that we can use the Aliases i.e

select aekorg aekgrp ... .

if it helps dont forget the REWARD.

rgds

harris

Read only

Former Member
0 Likes
883

Hi,

eine inner join eine is meaning less.use like this.

select ekorg ekgrp into wa from eine where where

matnr = it_rkwa-matnr_rkwa

and lifnr = it_rkwa-lifnr_rkwa.

endselect.

rgds,

bharat.