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: 

SUBQUERY with INNER JOIN in ABAP

Former Member
0 Kudos

Hi Expert

How Can I write SUBQUERY with INNER JOIN in ABAP.

thanks

6 REPLIES 6

Former Member
0 Kudos

Hi,

check this code..

SELECT a~pernr a~begda a~endda a~branc b~nachn b~vorna
 FROM pa0023 as a
   INNER JOIN pa0002 as b  
   ON a_pernr = b~pernr
INTO TABLE ifinal
WHERE a~pernr IN ( select pernr from pa0023
where aedtm = p_aedtm and
uname ne 'KA51151' )

.

0 Kudos

thanks Avinash,

Actually I need multiple select stetement to combine with join..

Like:

(Select abc, cde from tabe1,tab2 on ) INNER JOIN (Select abc, cde from tabe1,tab2 on ) INNER JOIN Select abc, cde from tabe1,tab2 on )

like that . Can u plaese tell me how to write this requirement with the right syntax

0 Kudos

Hi Ajay,

could you please be clear on the requirement as this is not possible in ABAP because you can only give inner join with tables and not the records of the tables....

mention properly as to what you want and we can give you the query....

Regards,

Siddarth

0 Kudos

Thanks Sidhharth for your Respose

Actually I need data from VBAP, VBAK, VBUP, VBUK and VBKD with all functional validation satisfied for a sales order item data. The requirement is to report all item data with other information from table VBAK, VBUP, VBUK and VBKD in a corresponding record with ALL data in VBAP.

Your help is appriciated.

see the below query for reference

select alias_vbap~vbeln from vbap as

alias_vbap inner join vbak as alias_vbak

on alias_vbapvbeln eq alias_vbakvbeln

"and alias_vbak~bukrs_vf eq '2400'

inner join vbuk as alias_vbuk

on alias_vbukvbeln = alias_vbapvbeln

inner join vbup as alias_vbup

on alias_vbupvbeln = alias_vbapvbeln

and alias_vbupposnr = alias_vbapposnr

left OUTER join veda as alias_veda

on alias_vedavbeln = alias_vbapvbeln

and alias_vedavposn = alias_vbapposnr

left outer join vbkd as alias_vbkd

on alias_vbkdvbeln = alias_vbapvbeln

and alias_vbkdposnr = alias_vbapposnr

Former Member
0 Kudos

http://help.sap.com/saphelp_nw04/helpdata/en/dc/dc7614099b11d295320000e8353423/content.htm

SELECT * FROM ( ( MSEG AS A INNER JOIN MKPF AS B ON BMBLNR = AMBLNR )

INTO TABLE ITAB WHERE A~WERKS IN PLANTS

AND A~MATNR IN ( SELECT MATNR FROM MARA AS F WHERE MATKL IN MATGRP )

Former Member
0 Kudos

ya