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

Join with EKBE

sanjay_deshpande4
Participant
0 Likes
1,977

Dear All,

I am having below existing query. In this query now I want modification in such a way that

it_eine_latest will retain all values and EKBE will be joined in such a way that in case no entries from EKBE, the column from EKBE will be blank in it_eine_latest and if EKBE has values for EBELN/EBELP then those values should be available.

(D~BUDAT is nothing but EKBE~BUDAT)

SELECT a~infnr
a~ebeln
a~ebelp
a~datlb
a~netpr
a~peinh
b~netpr
c~lifnr
c~waers

D~BUDAT
FROM eine AS a JOIN
ekpo AS b
ON a~ebeln = b~ebeln AND
a~ebelp = b~ebelp
JOIN ekko AS c "ADORNAL CTASK0043115
ON b~ebeln = c~ebeln "ADORNAL CTASK0043115
INTO TABLE it_eine_latest
FOR ALL ENTRIES IN it_eina
WHERE a~infnr = it_eina-infnr AND
( a~esokz = '0' OR a~esokz = '3' ) AND " Std Order⋐con
a~bstyp = 'F' AND " PO
b~loekz = space AND
( b~pstyp = '0' OR b~pstyp = '3' )
AND c~bsart = 'NB'.

I will be thankful for kindly helping with above query.

Regards.

1 ACCEPTED SOLUTION
Read only

sanjay_deshpande4
Participant
1,625

Thanks Sandra Rossi for replying.

LEFT OUTER JOIN on EKBE is the solution.

Dear All,

I am having below existing query. In this query now I want modification in such a way that

it_eine_latest will retain all values and EKBE will be joined in such a way that in case no entries from EKBE, the column from EKBE will be blank in it_eine_latest and if EKBE has values for EBELN/EBELP then those values should be available.

(D~BUDAT is nothing but EKBE~BUDAT)

SELECT a~infnr
a~ebeln
a~ebelp
a~datlb
a~netpr
a~peinh
b~netpr
c~lifnr
c~waers

D~BUDAT
FROM eine AS a JOIN
ekpo AS b
ON a~ebeln = b~ebeln AND
a~ebelp = b~ebelp
JOIN ekko AS c "ADORNAL CTASK0043115
ON b~ebeln = c~ebeln "ADORNAL CTASK0043115
INTO TABLE it_eine_latest
FOR ALL ENTRIES IN it_eina
WHERE a~infnr = it_eina-infnr AND
( a~esokz = '0' OR a~esokz = '3' ) AND " Std Order⋐con
a~bstyp = 'F' AND " PO
b~loekz = space AND
( b~pstyp = '0' OR b~pstyp = '3' )
AND c~bsart = 'NB'.

I will be thankful for kindly helping with above query.

Regards.

2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
1,625

In your query, there are other tables joined, so I guess it's easy to do the same for EKBE. Did you try? If yes, what is your issue?

NB: I see other alike questions in the forum with some nice answers:

join EKKO EKPO "EKBE" site:sap.com
Read only

sanjay_deshpande4
Participant
1,626

Thanks Sandra Rossi for replying.

LEFT OUTER JOIN on EKBE is the solution.