<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FULL OUTER JOIN in ABAP SQL? in ABAP Forum</title>
    <link>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348852#M751</link>
    <description>&lt;P&gt;Hi Sandra,&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, this would hve been my solution, too. Would this be possible without the CTE?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another solution would be AMDP as HANA does Support a FULL OUTER JOIN.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
    <pubDate>Sat, 14 Mar 2026 08:05:16 GMT</pubDate>
    <dc:creator>BiberM</dc:creator>
    <dc:date>2026-03-14T08:05:16Z</dc:date>
    <item>
      <title>FULL OUTER JOIN in ABAP SQL?</title>
      <link>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348374#M742</link>
      <description>&lt;P&gt;FULL OUTER JOIN is still not permitted directly in ABAP 7.58 (ABAP Keyword Documentation: &lt;A href="https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-US/index.htm?file=abapselect_join.htm" target="_self"&gt;SELECT, FROM JOIN&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;What I'd like to do:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;    SELECT COALESCE( ekkn~ebeln, ekbe~ebeln ) AS ebeln,
           COALESCE( ekkn~ebelp, ekbe~ebelp ) AS ebelp,
           COALESCE( ekkn~zekkn, ekbe~zekkn ) AS zekkn,
           ekbe~bewtp,
           ekkn~loekz
      FROM ekbe
           FULL OUTER JOIN ekkn     " &amp;lt;=== FULL not valid in ABAP SQL
             ON  ekkn~ebeln = ekbe~ebeln
             AND ekkn~ebelp = ekbe~ebelp
             AND ekkn~zekkn = ekbe~zekkn
      WHERE ...
      INTO TABLE &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1407137"&gt;@DATA&lt;/a&gt;(itab).&lt;/LI-CODE&gt;&lt;P&gt;What is the most simple workaround?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Sandra&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2026 14:31:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348374#M742</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2026-03-13T14:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: FULL OUTER JOIN in ABAP SQL?</title>
      <link>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348378#M743</link>
      <description>&lt;P&gt;The most simple workaround is via a CTE (&lt;A href="https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-US/index.htm?file=abapwith.htm" target="_self"&gt;WITH&lt;/A&gt;), UNION DISTINCT (&lt;A href="https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-US/index.htm?file=abapunion.htm#!ABAP_VARIANT_1@1@" target="_self"&gt;UNION&lt;/A&gt;, &lt;A href="https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-US/index.htm?file=abapunion.htm#!ABAP_ONE_ADD@1@" target="_self"&gt;DISTINCT&lt;/A&gt;) and two &lt;A href="https://help.sap.com/doc/abapdocu_756_index_htm/7.56/en-US/index.htm?file=abapselect_join.htm" target="_self"&gt;LEFT OUTER JOIN&lt;/A&gt; (see "Result set for outer joins"):&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;    TYPES: BEGIN OF ty_full_outer_join,
             ebeln TYPE ebeln,
             ebelp TYPE ebelp,
             zekkn TYPE dzekkn,
             bewtp TYPE ekbe-bewtp,
             loekz TYPE ekkn-loekz,
           END OF ty_full_outer_join.
    TYPES tt_full_outer_join TYPE STANDARD TABLE OF ty_full_outer_join WITH EMPTY KEY.

    DATA(itab) = VALUE tt_full_outer_join( ).
    WITH +union AS (
        SELECT ebeln, ebelp, zekkn
          FROM ekbe
        UNION DISTINCT
        SELECT ebeln, ebelp, zekkn
          FROM ekkn )
    SELECT +union~ebeln,
           +union~ebelp,
           +union~zekkn,
           ekbe~bewtp,
           ekkn~loekz
      FROM +union
           LEFT OUTER JOIN ekbe
             ON  ekbe~ebeln = +union~ebeln
             AND ekbe~ebelp = +union~ebelp
             AND ekbe~zekkn = +union~zekkn
           LEFT OUTER JOIN ekkn
             ON  ekkn~ebeln = +union~ebeln
             AND ekkn~ebelp = +union~ebelp
             AND ekkn~zekkn = +union~zekkn
      WHERE ...
      INTO TABLE @itab.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2026 14:39:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348378#M743</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2026-03-13T14:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: FULL OUTER JOIN in ABAP SQL?</title>
      <link>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348852#M751</link>
      <description>&lt;P&gt;Hi Sandra,&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, this would hve been my solution, too. Would this be possible without the CTE?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another solution would be AMDP as HANA does Support a FULL OUTER JOIN.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2026 08:05:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348852#M751</guid>
      <dc:creator>BiberM</dc:creator>
      <dc:date>2026-03-14T08:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: FULL OUTER JOIN in ABAP SQL?</title>
      <link>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348919#M753</link>
      <description>&lt;P&gt;I guess it's possible without the CTE, but it will be less elegant, less legible.&lt;/P&gt;&lt;P&gt;If you find a solution without the CTE, please post it as another solution.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2026 11:10:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14348919#M753</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2026-03-14T11:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: FULL OUTER JOIN in ABAP SQL?</title>
      <link>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14350096#M760</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I just tried the following in our dev system with very limited data (4-digit line count in each table). The performance was .... I just did one run.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;    SELECT coalesce( ekbe~ebeln, ekkn~ebeln ) as ebeln,
           coalesce( ekbe~ebelp, ekkn~ebelp ) as ebelp,
           coalesce( ekbe~zekkn, ekkn~zekkn ) as zekkn,
           ekbe~bewtp,
           ekkn~loekz
    FROM ekbe
      LEFT OUTER JOIN ekkn
        ON    ekbe~ebeln = ekkn~ebeln
          AND ekbe~ebelp = ekkn~ebelp
          AND ekbe~zekkn = ekkn~zekkn
*    WHERE ...
    UNION
    SELECT coalesce( ekbe~ebeln, ekkn~ebeln ) as ebeln,
           coalesce( ekbe~ebelp, ekkn~ebelp ) as ebelp,
           coalesce( ekbe~zekkn, ekkn~zekkn ) as zekkn,
           ekbe~bewtp,
           ekkn~loekz
    FROM ekkn
      LEFT OUTER JOIN ekbe
        ON    ekbe~ebeln = ekkn~ebeln
          AND ekbe~ebelp = ekkn~ebelp
          AND ekbe~zekkn = ekkn~zekkn
*    WHERE ...
    INTO TABLE &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1407137"&gt;@DATA&lt;/a&gt;(lt_result).

    out-&amp;gt;write( lt_result ).&lt;/LI-CODE&gt;&lt;P&gt;The idea is to do both "parts" of a FULL OUTER JOIN seperately and then unite them with a UNION. This one especially without the ALL addition in order to remove the duplicates which are the datasets which exists in both tables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;Michael&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2026 14:22:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14350096#M760</guid>
      <dc:creator>BiberM</dc:creator>
      <dc:date>2026-03-16T14:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: FULL OUTER JOIN in ABAP SQL?</title>
      <link>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14364570#M838</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;yes this is what i would have suggested as well,&lt;BR /&gt;&lt;BR /&gt;Just with left and right outer in the union branches , see below.&lt;BR /&gt;&lt;BR /&gt;Depending on the database (or engines) used the union branches might be executed in parallel.&lt;BR /&gt;In my case the select returns 323 records (EKBE 3211 records&amp;nbsp; EKKN 582 records)&amp;nbsp; in 6.5 ms. The&lt;BR /&gt;UNION branches are executed in parallel.&lt;BR /&gt;&lt;BR /&gt;With larger volumes (EKBE&amp;nbsp;20,001,016 rows and&amp;nbsp;117,896,463) it returns 8345 records in 160 ms.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;BR /&gt;&lt;BR /&gt;Hermann&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;SELECT COALESCE( ekkn~ebeln, ekbe~ebeln ) AS ebeln,
           COALESCE( ekkn~ebelp, ekbe~ebelp ) AS ebelp,
           COALESCE( ekkn~zekkn, ekbe~zekkn ) AS zekkn,
           ekbe~bewtp,
           ekkn~loekz
      FROM ekbe
           LEFT OUTER JOIN ekkn     " &amp;lt;=== FULL not valid in ABAP SQL
             ON  ekkn~ebeln = ekbe~ebeln
             AND ekkn~ebelp = ekbe~ebelp
             AND ekkn~zekkn = ekbe~zekkn
      WHERE ekbe~gjahr = '2026'
 UNION
  SELECT COALESCE( ekkn~ebeln, ekbe~ebeln ) AS ebeln,
           COALESCE( ekkn~ebelp, ekbe~ebelp ) AS ebelp,
           COALESCE( ekkn~zekkn, ekbe~zekkn ) AS zekkn,
           ekbe~bewtp,
           ekkn~loekz
      FROM ekbe
           RIGHT OUTER JOIN ekkn     " &amp;lt;=== FULL not valid in ABAP SQL
             ON  ekkn~ebeln = ekbe~ebeln
             AND ekkn~ebelp = ekbe~ebelp
             AND ekkn~zekkn = ekbe~zekkn
      WHERE ekkn~aedat = '20260101'
      INTO TABLE (itab).&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2026 12:46:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/abap-forum/full-outer-join-in-abap-sql/m-p/14364570#M838</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2026-04-02T12:46:25Z</dc:date>
    </item>
  </channel>
</rss>

