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

Problem when doing inner join for three tables....

Former Member
0 Likes
920

DATA: V3 TYPE VBAP-MAKTL.

SELECT single vbap~matkl into V3

from VBAP

inner join VBFA

inner join LIPS

on LIPSPOSNR = VBFAPOSNN

and vbapvbeln = vbfavbelv

and vbapposnr = vbfaposnv

where LIPSVBELN = VBFAVBELN = '0080000834'

and vbfa~vbtyp_n = 'J'

and LIPS~J_3ASIZE = '0884'.

Error: Wrong expression "INNER" in from clause...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
791

hi Tushar,

Your syntax for inner join is wrong refer help

6 REPLIES 6
Read only

Former Member
0 Likes
791

Tushar,

Do this..

SELECT single vbap~matkl into V3

from VBAP

inner join VBFA

on vbapvbeln = vbfavbelv

vbapposnr = vbfaposnv

inner join LIPS

on LIPSPOSNR = VBFAPOSNN

where LIPSVBELN = VBFAVBELN = '0080000834'

and vbfa~vbtyp_n = 'J'

and LIPS~J_3ASIZE = '0884'.

Message was edited by: Phani Kiran Nudurupati

Read only

0 Likes
791

SELECT single vbap~matkl into V3

from ( ( VBAP as vbap inner join VBFA as vbfa

ON vbap-vbeln = vbfa-vbelp )

inner join LIPS as lips

on LIPSPOSNR = VBFAPOSNN

and vbapvbeln = vbfavbelv

and vbapposnr = vbfaposnv )

where LIPSVBELN = VBFAVBELN = '0080000834'

and vbfa~vbtyp_n = 'J'

and LIPS~J_3ASIZE = '0884'.

Read only

Former Member
0 Likes
792

hi Tushar,

Your syntax for inner join is wrong refer help

Read only

Former Member
0 Likes
791

SELECT single vbap~matkl into V3

from ( ( VBAP inner join VBFA

ON vbap-vbeln = vbfa-vbelp )

inner join LIPS

on LIPSPOSNR = VBFAPOSNN

and vbapvbeln = vbfavbelv

and vbapposnr = vbfaposnv )

where LIPSVBELN = VBFAVBELN = '0080000834'

and vbfa~vbtyp_n = 'J'

and LIPS~J_3ASIZE = '0884'.

Read only

Former Member
0 Likes
791

Hello Tushar,

Why you are using the 3 table inner join. If the volume of data is big then this statement will give to time out. Use "for all entries" statement to select the data from the table.

Like

select field1 field2 from LIPS into i_lips

where LIPS~J_3ASIZE = '0884'.

select f3 f4 from vbfa into i_vbfa for all entries in i_lips where field1 = i_lips-field1 and so on

and

use same to select data from VBAP.

Hope this will help

Read only

0 Likes
791

SELECT single vbap~matkl into V3

from VBAP

inner join VBFA

on vbapvbeln = vbfavbelv

and vbapposnr = vbfaposnv

inner join LIPS

on LIPSPOSNR = VBFAPOSNN

and LIPSVBELN = VBFAVBELN

where LIPS~VBELN = '0080000834'

and vbfa~vbtyp_n = 'J'

and LIPS~J_3ASIZE = '0884'.