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

left outer join

Former Member
0 Likes
665

The following code doesn't work because you can't have two left outer joins in a single slect statement:

select ekko~ebeln ekpo~ebelp lifnr ekpo~matnr ekpo~menge ekpo~meins
          ekbe~vgabe budat ekbe~menge as meng1 wrbtr ekbe~waers
  from   ekko left outer join ekpo on ekko~ebeln = ekpo~ebeln 
                     left outer join ekbe on ekbe~ebeln = ekpo~ebeln
                                                and ekbe~ebelp = ekpo~ebelp 
  into corresponding fields of table i_order
  where ekko~ebeln = p_order
  order by ekpo~ebelp.

So how might I easily do this (I can think of a few verbose ways of doing it)? Basically I need to list POs even if there are no items (first outer join), and if there are items but no history (second outer join).

Thanks,

Chris.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
545

Actually your assumption is incorrect. You are allowed multiple left outer joins on an SELECT But you are not allowed to reference the fields on other tables. The error you are getting is because you are trying to JOIN EKBE using a field from EKPO. You have already defined EKPO as a left outer join.

3 REPLIES 3
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
545

use view WB2_V_EKKO_EKPO2 and then directly select the data and then use a for all entries to ekbe.

avoid the joins

Read only

Former Member
0 Likes
546

Actually your assumption is incorrect. You are allowed multiple left outer joins on an SELECT But you are not allowed to reference the fields on other tables. The error you are getting is because you are trying to JOIN EKBE using a field from EKPO. You have already defined EKPO as a left outer join.

Read only

0 Likes
545

Yes, thanks for that. As you say, it's possible for two or more outer joins, provided a single table does not have an outer join in both directions, so to speak.