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: 

select-options: in inner join

Former Member
0 Kudos
2,222

in this peace of code i got error message like:

The column name "VBELN" has two meanings..

Please let me know how to resolve this <b>select-options:</b> problem

tables:vbap,lips,likp.

data: begin of first occurs 0,

vbeln1 like vbap-vbeln,

matnr2 like vbap-matnr,

werks3 like lips-werks,

route4 like likp-route,

end of first.

select-options: enter for vbap-vbeln.

select

a~vbeln

a~matnr

b~werks

c~route

into table first

from vbap as a

inner join lips as b

on avbeln = bvbeln

inner join likp as c

on bvbeln = cvbeln

<b> where vbeln in enter.</b>

loop at first.

write:/2 sy-vline, first-vbeln1,

sy-vline,first-matnr2,

sy-vline,first-werks3,

sy-vline,first-route4.

endloop.

Thanks In advance

~~SANDY~~~

1 ACCEPTED SOLUTION

Former Member
0 Kudos
203

Hi,

Give like this,

tables:vbap,lips,likp.

data: begin of first occurs 0,

vbeln1 like vbap-vbeln,

matnr2 like vbap-matnr,

werks3 like lips-werks,

route4 like likp-route,

end of first.

select-options: enter for vbap-vbeln.

select

a~vbeln

a~matnr

b~werks

c~route

into table first

from vbap as a

inner join lips as b

on avbeln = bvbeln

inner join likp as c

on bvbeln = cvbeln

where<b> a~vbeln</b> in enter.

loop at first.

write:/2 sy-vline, first-vbeln1,

sy-vline,first-matnr2,

sy-vline,first-werks3,

sy-vline,first-route4.

endloop.

Regards,

Padmam.

8 REPLIES 8

Former Member
0 Kudos
204

Hi,

Give like this,

tables:vbap,lips,likp.

data: begin of first occurs 0,

vbeln1 like vbap-vbeln,

matnr2 like vbap-matnr,

werks3 like lips-werks,

route4 like likp-route,

end of first.

select-options: enter for vbap-vbeln.

select

a~vbeln

a~matnr

b~werks

c~route

into table first

from vbap as a

inner join lips as b

on avbeln = bvbeln

inner join likp as c

on bvbeln = cvbeln

where<b> a~vbeln</b> in enter.

loop at first.

write:/2 sy-vline, first-vbeln1,

sy-vline,first-matnr2,

sy-vline,first-werks3,

sy-vline,first-route4.

endloop.

Regards,

Padmam.

0 Kudos
203

ya

Padmam

but also it not showing out put Please hepl me in this regard.

Former Member
0 Kudos
203

Hi Sandy,

The error has occurred due to ambiguity of vbeln from which table it needs to be consider. Speicy vbeln as a~vbeln to resolve the issue.

Change code as in BOLD.

select-options: enter for vbap-vbeln.

select

a~vbeln

a~matnr

b~werks

c~route

into table first

from vbap as a

inner join lips as b

on avbeln = bvbeln

inner join likp as c

on bvbeln = cvbeln

<b>where a~vbeln in enter.</b>

Don't use INNER JOINS for more than 2 levels as it will have great impact on performance and use FOR ALL ENTRIES instead of INNER JOINS.

Thanks,

Vinay

Message was edited by:

Vinaykumar G

Former Member
0 Kudos
203

Hiii

Change the condition in where clause

Where a~VBELN IN ENTER

Regards

hitesh

0 Kudos
203

hi,

after using <b>a~</b> also out put is not coming

When i debugged it it is not fetching any data

what to do?????????

Thanks in advance

~~~sandy~~~

0 Kudos
203

Hi Sandy,

As you didn't have any relationship statements among the LIPS and VBAP.

Try as follows.

select-options: enter for vbap-vbeln.

select

a~vbeln

a~matnr

b~werks

c~route

into table first

from vbap as a

inner join lips as b

<b>on avbeln = bvgbel and aposnr = bvgpos

where a~vbeln in enter

</b>inner join likp as c

on bvbeln = cvbeln.

Thanks,

Vinay

0 Kudos
203

Hi,

Try this one,it is working fine,

tables:vbap,lips,likp.

data: begin of first occurs 0,

vbeln like vbap-vbeln,

matnr like vbap-matnr,

werks like lips-werks,

route like likp-route,

end of first.

select-options: enter for vbap-vbeln.

<b>select avbeln amatnr bwerks croute into corresponding fields of table first

from vbap as a inner join lips as b on avbeln = bvgbel

inner join likp as c on bvbeln = cvbeln

where a~vbeln in enter.</b>

loop at first.

write:/2 sy-vline, first-vbeln,

sy-vline,first-matnr,

sy-vline,first-werks,

sy-vline,first-route.

endloop.

Regards,

Padmam.

Former Member
0 Kudos
203

hi,

check the tables you are using for the vbeln,because it is having two different meanings in the data base tables because vbeln is used for the sales order as well as delivery number depending upon the database table.

please check this once.

please donot forget to reward points if it helps you.

all the best