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: 

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

Former Member
0 Kudos

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

Former Member
0 Kudos

hi Tushar,

Your syntax for inner join is wrong refer help

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

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'.

Former Member
0 Kudos

hi Tushar,

Your syntax for inner join is wrong refer help

Former Member
0 Kudos

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'.

Former Member
0 Kudos

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

0 Kudos

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'.