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: 

ABAP: OUTER JOIN

vallamuthu_madheswaran2
Active Contributor
0 Kudos

Hi friends,

i want the correct syntax of the following query

SELECT ABEDAT AEBELN Bmatkl BWERKS BMATNR BTXZ01 ARESWK BMENGE B~EBELP

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM EKKO AS A INNER JOIN EKPO AS B ON AEBELN = BEBELN

WHERE a~reswk IN SUP_PLNT

and A~BEDAT IN STO_DATE

AND B~MATKL IN mat_grp

AND B~MATNR IN MAT_CODE

AND A~BSART = 'KRUB'.

thanks & regards

vallamuthu.M

1 ACCEPTED SOLUTION

Former Member
0 Kudos

The code looks to be fine..are you getting any error ??

Secondly, you specified the topic for Outer join and ur code is for inner join ..can you please give the exact issue.

4 REPLIES 4

Former Member
0 Kudos

The code looks to be fine..are you getting any error ??

Secondly, you specified the topic for Outer join and ur code is for inner join ..can you please give the exact issue.

0 Kudos

HI,

SORRY, THE BELOW QUERY IS THE CORRECT QUERY PLEASE HELP ME.

SELECT ABEDAT AEBELN Bmatkl BWERKS BMATNR BTXZ01 ARESWK BMENGE B~EBELP

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM EKKO LEFT OUTER JOIN EKPO ON AEBELN = BEBELN

WHERE a~reswk IN SUP_PLNT

and A~BEDAT IN STO_DATE

AND B~MATKL IN mat_grp

AND B~MATNR IN MAT_CODE

AND A~BSART = 'KRUB'.

0 Kudos

U cannot use filters for fields from the right table..In your case EKPO.

So if you <b>take out the filters for maktl and matnr</b> it should work...surely you can apply the same filter later on to the internal table.

0 Kudos

Hi,

Just change the bold code and check.

SELECT ABEDAT AEBELN Bmatkl BWERKS BMATNR BTXZ01 ARESWK BMENGE B~EBELP

INTO CORRESPONDING FIELDS OF TABLE ITAB

<b>FROM EKKO as A LEFT OUTER JOIN EKPO as B</b> ON AEBELN = BEBELN

WHERE a~reswk IN SUP_PLNT

and A~BEDAT IN STO_DATE

AND B~MATKL IN mat_grp

AND B~MATNR IN MAT_CODE

AND A~BSART = 'KRUB'.

Hope this helps.