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

FULL OUTER JOIN with ABAP CDS

12,667

How can I implement a FULL OUTER JOIN in ABAP CDS ?

How can I implement a FULL OUTER JOIN in ABAP CDS ?

5 REPLIES 5
Read only

Sathya_Gunasekaran
Contributor
0 Likes
4,142

Have you tried UNION ?

Read only

0 Likes
4,142

I was thinking about

LEFT OUTER JOIN

UNION

RIGHT OUTER JOIN

but I am not sure if this is the best way to do it.

Read only

0 Likes
4,142

You may want to use 'DISTINCT' to eliminate duplicates!

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
4,142

CROSS JOIN?

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abencds_f1_joined_...

I know it is a difference, but maybe it is what you need?

Read only

4,142

Thank you for the suggestion.

While a CROSS JOIN does all combinations of the LHS and RHS, a FULL OUTER JOIN is a UNION of LEFT OUTER and RIGHT OUTER JOINS. I decided to go with the later solution. May not be the best way to do it but I think this is something that one would expect out of CDS views in ABAP given that it is available in HANA.

I can't think of a way to use a CROSS JOIN in lieu of a FULL OUTER JOIN.

Just for the enlightenment of readers, here is a note on FULL OUTER JOIN available in HANA

https://blogs.sap.com/2014/05/25/all-about-joins-using-sql-in-hana/