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: 

want to get an additional field in the output screen using inner join

Former Member
0 Kudos

i am having a select query.

Select vvbeln vspart vtext

into corresponding fields of table it_tspat

from VBAP as v INNER JOIN TSPAT as t

ON vspart = tspart

for all entries in it_zp1012_so_app_h

where spras = 'EN'

and vbeln = it_zp1012_so_app_h-vbeln+0(10).

now i have to retrieve BZIRK from table VBKD in the same select query above

and want to display vbeln,spart,vtext,bzirk in the output

3 REPLIES 3

Former Member
0 Kudos

hi santosh i sending query for inner join for three ale...u ll get all ur answers..

select bean11 amatnr cmaktx amenge ameins admbtr into

corresponding fields of table itab_main1 from ( ( makt as c inner join

mseg as a on cmatnr = amatnr ) inner join mara as b on a~matnr =

b~matnr ) where mblnr = pa.

Former Member
0 Kudos
Select v~vbeln v~spart a~bzirk
                    into corresponding fields of table i_vbkd
                    from VBAP as v INNER JOIN VBKD as a
                   ON v~vbeln = a~vbeln
                   AND v~posnr = a~posnr
                   for all entries in it_zp1012_so_app_h
                   where v~vbeln = it_zp1012_so_app_h-vbeln+0(10).

if sy-subrc = 0.
 select vtext from tspat
                  into i_tspat
                 for all entries in i_vbkd
                 where spart = i_vbkd-spart
                  AND SPAS = 'EN'.
ENDIF.

LOOP AT i_vbkd.
READ TABLE i_tspat WITH KEY spart = i_vbkd=spart.
 if sy-subrc = 0.
 i_vbkd-vtext = i_tspat-vtext.
endif.
CLEAR i_vbkd.
ENDLOOP.

Hope this will oslve ir problem.

Reward if this helsp.

Former Member
0 Kudos

Hi,

Join VBKD also with VBAP:

Select vvbeln vspart vtext cbzirk

into corresponding fields of table it_tspat

from ( VBAP as v INNER JOIN TSPAT as t

ON vspart = tspart ) join VBKD as c

on vvbeln = cvbeln

for all entries in it_zp1012_so_app_h

where spras = 'EN'

and vbeln = it_zp1012_so_app_h-vbeln+0(10).

Regards,

Anji