2022 Nov 02 9:19 PM
I'm trying to do a left outer join between an itab and a DBtab. The results are identical to an inner join. Am I doing something wrong or is this not supported? Couldn't find any stipulation in the documentation.
Example
SELECT FROM @lt_mutable_implementations AS all
LEFT OUTER JOIN ztsl_impl_users AS specific
ON all~impl_id = specific~impl_id
FIELDS all~impl_id,
specific~low,
specific~muted,
specific~mute_expiration
WHERE specific~low = @if_email
AND specific~muted = @abap_true
INTO TABLE @DATA(lt_details).<br>
2022 Nov 03 9:14 AM
In the WHERE clause of the SELECT statement, you have put some criteria on the fields of the table linked by the LEFT OUTER JOIN.
As these criteria are not part of the JOIN conditions (ON condition), these fields contain NULL values and excluded by the WHERE option.
Did you try to move those criteria to the ON condition?
2022 Nov 03 7:58 AM
This code works fine for me, the database table SCARR contains the value 'LH' but not '??' (ABAP 7.52).
TYPES: BEGIN OF ty_itab_line,
carrid TYPE scarr-carrid,
END OF ty_itab_line,
ty_itab TYPE STANDARD TABLE OF ty_itab_line WITH EMPTY KEY.
DATA(itab) = VALUE ty_itab( ( carrid = 'LH' ) ( carrid = '??' ) ).
DATA(result) = VALUE ty_itab( ).
SELECT itab~carrid FROM @itab AS itab INNER JOIN scarr ON itab~carrid = scarr~carrid INTO TABLE @result.
ASSERT result = VALUE ty_itab( ( carrid = 'LH' ) ).
SELECT itab~carrid FROM @itab AS itab LEFT OUTER JOIN scarr ON itab~carrid = scarr~carrid INTO TABLE @result.
ASSERT result = VALUE ty_itab( ( carrid = 'LH' ) ( carrid = '??' ) ).
2022 Nov 03 9:14 AM
In the WHERE clause of the SELECT statement, you have put some criteria on the fields of the table linked by the LEFT OUTER JOIN.
As these criteria are not part of the JOIN conditions (ON condition), these fields contain NULL values and excluded by the WHERE option.
Did you try to move those criteria to the ON condition?
2022 Nov 03 1:58 PM