Skip to Content
0
Aug 08, 2023 at 10:34 AM

Dynamic table name according to a field value in left outer join

32 Views

Hello Experts,

In left outer join the table in the right side depends on the value of a field in the left side table.

For example

1. Select from tbl1

2. If tbl1-fld2 = 1

then

Select fld1 into corresponding …

From tbl1

Left outer join tbl2_a

Else

Select fld1 into corresponding …

From tbl1

Left outer join tbl2_b

Something like that:

Select fld1 into corresponding …

From tbl1

Left outer join case tbl1~fld2 = 1 (tbl2_a)

Else (tbl2_b)

On ….

How can I write it in ABAP's select statement?

Thank you

Hagit