<?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: Passing a range in open sql select join conditions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229697#M2042510</link>
    <description>&lt;P&gt;Hello Sandra. I did not notice the missing part which is&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1962174"&gt;@Space&lt;/a&gt;. I fix the above code.&lt;/P&gt;&lt;P&gt;I am trying to find a solution to my logic which is: I want to display all the customers who satisfy the where clause and I want the data from ZTABLE for the above vendors which satisfy the ON clause in the above select. In a few words, I want all the vendors from LFA1, LFB1 to be displayed and the data from ZTABLE for some of them, the others have empty fields from ZTABLE.&lt;/P&gt;&lt;P&gt;How I can do it?&amp;nbsp; Thanks&lt;/P&gt;</description>
    <pubDate>Sun, 28 Sep 2025 07:39:05 GMT</pubDate>
    <dc:creator>ekekakos</dc:creator>
    <dc:date>2025-09-28T07:39:05Z</dc:date>
    <item>
      <title>Passing a range in open sql select join conditions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229520#M2042508</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have the below problem and I do not know if there is a solution. The system is an ECC EHP8 so it is 7.50.&lt;/P&gt;&lt;P&gt;I have the below SQL:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;SELECT FROM lfa1 INNER JOIN lfb1
        ON lfa1~lifnr = lfb1~lifnr AND
           lfb1~bukrs = _options_structure-p_bukrs
      LEFT JOIN ztable
        ON ztable~rzzlifnr = lfa1~lifnr AND
           ztable~rbukrs = lfb1~bukrs AND
           ztable~rzzumskz &amp;lt;&amp;gt; &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1962174"&gt;@Space&lt;/a&gt; AND
           ztable~rzzumskz NOT IN (@range_umskz)
FIELDS DISTINCT lfa1~lifnr, lfb1~mindk, lfb1~busab
WHERE lfa1~lifnr IN _options_structure-s_lifnr AND
          lfa1~ktokk IN _options_structure-s_ktokk AND
          lfb1~akont IN _options_structure-s_akont AND
          lfb1~mindk IN _options_structure-s_mindk AND
          lfb1~busab IN _options_structure-s_busab
INTO TABLE (LOCAL_TABLE).&lt;/LI-CODE&gt;&lt;P&gt;The problem I am getting is with the range &lt;STRONG&gt;RANGE_UMSKZ&lt;/STRONG&gt;. And the error is:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;"&lt;STRONG&gt;range_umskz&lt;/STRONG&gt;" cannot be a table or a reference and cannot contain either of these objects or strings.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Is there anyway to pass this range in JOIN ON condition, because if I put it in where I will loose the record and not the values of the Ztable.&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Elias&lt;/P&gt;</description>
      <pubDate>Sun, 28 Sep 2025 07:51:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229520#M2042508</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2025-09-28T07:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a range in open sql select join conditions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229542#M2042509</link>
      <description>&lt;P&gt;In ABAP 7.50, probably no other solution than taking the range out of the LEFT JOIN and filtering the internal table after SELECT.&lt;/P&gt;&lt;P&gt;But what is the goal of doing a LEFT OUTER JOIN in your SELECT? The SELECT you show, with or without the LEFT OUTER JOIN, are 100% equivalent.&lt;/P&gt;&lt;P&gt;NB: your SELECT has currently an invalid syntax for sure (@ everywhere or nowhere, missing right argument in "ztable~rzzumskz &amp;lt;&amp;gt; AND").&lt;/P&gt;</description>
      <pubDate>Sat, 27 Sep 2025 13:27:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229542#M2042509</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2025-09-27T13:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a range in open sql select join conditions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229697#M2042510</link>
      <description>&lt;P&gt;Hello Sandra. I did not notice the missing part which is&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1962174"&gt;@Space&lt;/a&gt;. I fix the above code.&lt;/P&gt;&lt;P&gt;I am trying to find a solution to my logic which is: I want to display all the customers who satisfy the where clause and I want the data from ZTABLE for the above vendors which satisfy the ON clause in the above select. In a few words, I want all the vendors from LFA1, LFB1 to be displayed and the data from ZTABLE for some of them, the others have empty fields from ZTABLE.&lt;/P&gt;&lt;P&gt;How I can do it?&amp;nbsp; Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 28 Sep 2025 07:39:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229697#M2042510</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2025-09-28T07:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a range in open sql select join conditions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229703#M2042511</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, the SELECT you show will be equivalent to the same SELECT without LEFT OUTER JOIN because you don't extract any column from ZTABLE.&lt;/P&gt;&lt;P&gt;In ABAP 7.50, not a lot of solutions.&lt;/P&gt;&lt;P&gt;First solution: take the range selection out of the LEFT JOIN and filter the internal table after SELECT.&lt;/P&gt;&lt;P&gt;Second solution, based on the fact that WHERE IS NULL on a left-joined table column means that there's no line found in table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;DATA range_currency TYPE RANGE OF sflight-currency.
range_currency = VALUE #( ( sign = 'I' option = 'EQ' low = 'USD' ) ).
SELECT
  FROM scarr
       LEFT JOIN sflight
         ON  sflight~carrid    = scarr~carrid
         AND sflight~currency &amp;lt;&amp;gt; 'EUR'
  FIELDS scarr~carrid,
         sflight~connid,
         sflight~currency
  WHERE sflight~currency     IS NULL
     OR sflight~currency NOT IN @range_currency
  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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Third solution, by building the from/join dynamically with rzzumskz &amp;lt;&amp;gt; value1 AND rzzumskz &amp;lt;&amp;gt; value2 ... instead of your ranges table (range_umskz), assuming that it's composed of lines I EQ value1 ...:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;TYPES: BEGIN OF itab_line,
         carrid   TYPE scarr-carrid,
         connid   TYPE sflight-connid,
         currency TYPE sflight-currency,
       END OF itab_line.
DATA itab TYPE STANDARD TABLE OF itab_line.
DATA range_currency TYPE RANGE OF sflight-currency.
range_currency = VALUE #( ( sign = 'I' option = 'EQ' low = 'USD' ) ).
DATA(dynamic_from) = ` scarr`
                  &amp;amp;&amp;amp; ` LEFT JOIN sflight`
                  &amp;amp;&amp;amp; `   ON  sflight~carrid    = scarr~carrid`
                  &amp;amp;&amp;amp; `   AND sflight~currency &amp;lt;&amp;gt; 'EUR'`.
LOOP AT range_currency ASSIGNING FIELD-SYMBOL(&amp;lt;line_range_currency&amp;gt;)
        WHERE     sign   = 'I'
              AND option = 'EQ'.
  dynamic_from = dynamic_from &amp;amp;&amp;amp; | AND sflight~currency &amp;lt;&amp;gt; '{ &amp;lt;line_range_currency&amp;gt;-low }'|.
ENDLOOP.
SELECT scarr~carrid,
       sflight~connid,
       sflight~currency
  FROM (dynamic_from)
  INTO TABLE @itab.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Sep 2025 09:03:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229703#M2042511</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2025-09-28T09:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a range in open sql select join conditions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229715#M2042512</link>
      <description>&lt;P&gt;Unfortunately, it does not work as it returns 200 records less. Most probably, I will take out the ZTABLE, I will read it for all vendors that we have from the previous select and the with a loop I pass the values for the specific vendors.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 28 Sep 2025 09:02:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229715#M2042512</guid>
      <dc:creator>ekekakos</dc:creator>
      <dc:date>2025-09-28T09:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a range in open sql select join conditions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229717#M2042513</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/38961"&gt;@ekekakos&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I did not notice the missing part which is&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1962174"&gt;@Space&lt;/a&gt;. I fix the above code.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks, bug reproduced and just reported here:&amp;nbsp;&lt;A href="https://community.sap.com/t5/questions-about-sap-websites/bug-report-quot-space-quot-disappears-from-code-section-when-editing/qaq-p/14229716" target="_blank"&gt;Bug Report: "@space" disappears from code section ... - SAP Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Sep 2025 09:15:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229717#M2042513</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2025-09-28T09:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a range in open sql select join conditions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229719#M2042514</link>
      <description>&lt;P&gt;Please clarify your question, because as I understood it, I tested the 3 solutions and all of them solve your question.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Sep 2025 09:24:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/passing-a-range-in-open-sql-select-join-conditions/m-p/14229719#M2042514</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2025-09-28T09:24:20Z</dc:date>
    </item>
  </channel>
</rss>

