Skip to Content
Nov 04, 2020 at 01:46 PM

ABAP SQL join where the joining fields are based on a condition


Hi all,

I want to join tables (TAB1 and TAB2) together on two columns depending on whether one of the columns is empty or not.
If TAB1-FIELD1 is not empty then I want to join on FIELD1, else I want to join on FIELD2.

I could do this by selecting TAB1 into an internal table and then doing a select for each line in the table but there must be a better way to do this?

Any help is appreciated.