<?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: Splitting the Join condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158784#M1977782</link>
    <description>&lt;P&gt;Thanks for your help Satish &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 20 May 2020 04:18:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2020-05-20T04:18:02Z</dc:date>
    <item>
      <title>Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158777#M1977775</link>
      <description>&lt;P&gt;Hi experts,&lt;/P&gt;
  &lt;P&gt;I hope you are doing well. I have a requirement to break the below select query without using JOIN, could anyone help me to do this.&lt;/P&gt;
  &lt;P&gt;SELECT a~mblnr&lt;BR /&gt; a~mjahr&lt;BR /&gt; a~bldat&lt;BR /&gt; a~budat&lt;BR /&gt; a~xblnr&lt;BR /&gt; b~matnr&lt;BR /&gt; b~werks&lt;BR /&gt; b~lgort&lt;BR /&gt; b~erfmg&lt;BR /&gt; b~erfme&lt;BR /&gt; b~j_3asiz&lt;BR /&gt; b~j_4ksca FROM mkpf AS a JOIN mseg AS b ON ( a~mblnr EQ b~mblnrAND a~mjahr EQ b~mjahr ) INTO TABLE g_it_mkpf_mseg&lt;/P&gt;
  &lt;P&gt;FOR ALL ENTRIES IN g_it_sales&lt;/P&gt;
  &lt;P&gt;WHERE a~xblnr EQ g_it_sales-vbeln_dlv AND b~shkzg EQ 'S'.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 11:06:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158777#M1977775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-05-15T11:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158778#M1977776</link>
      <description>&lt;P&gt;Maybe you want to describe why you want to do that? If you need data of both tables than a join is necessary, except you do the ugly way with two selects and combining the data on the application server level.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 11:09:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158778#M1977776</guid>
      <dc:creator>pfefferf</dc:creator>
      <dc:date>2020-05-15T11:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158779#M1977777</link>
      <description>&lt;P&gt;Hi  &lt;SPAN class="mention-scrubbed"&gt;aya743&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;You could do it like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF g_it_sales[] IS NOT INITIAL.
  SELECT mblnr, mjahr, bldat, budat, xblnr
    FROM mkpf 
    FOR ALL ENTRIES IN @g_it_sales
    WHERE xblnr = @g_it_sales-vbeln_dlv
    INTO TABLE @DATA(lt_mkpf).
  IF sy-subrc = 0.
    SELECT mblnr, mjahr, zeile, matnr, werks, lgort, erfmg, erfme, j_3asiz, j_4ksca 
      FROM mseg 
      FOR ALL ENTRIES IN @lt_mkpf
      WHERE mblnr = @lt_mkpf-mblnr
        AND mjahr = @lt_mkpf-mjahr
        AND shkzg = 'S'
      INTO TABLE @DATA(lt_mseg).
  ENDIF.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Mateusz&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 11:14:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158779#M1977777</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-05-15T11:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158780#M1977778</link>
      <description>&lt;P&gt;Hello &lt;SPAN class="mention-scrubbed"&gt;aya743&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Please be noted that JOIN should be preferred over multiple select queries to avoid multiple database fetch.&lt;/P&gt;&lt;P&gt;Your select query above has few flaws, however to answer your question in splitting the select query without join you have to understand the below points.&lt;/P&gt;&lt;P&gt;1) Your FOR ALL ENTRIES table is only applicable for MKPF, so your first select query must be on MKPF with the FOR ALL ENTRIES of  the table G_IT_SALES.&lt;/P&gt;&lt;P&gt;2) To connect the first query on MKPF to the table MSEG you must have common key fields which is MBLNR and MJAHR in this case. Hence your second query would be on MSEG with FOR ALL ENTRIES on internal table fetched from MKPF along with the where condition on SHLZG.&lt;/P&gt;&lt;P&gt;Below code is just pseudo code for your understanding.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  SELECT mblnr
         mjahr
         bldat
         budat
         xblnr
 FROM mkpf
 INTO TABLE g_it_mkpf
 FOR ALL ENTRIES IN g_it_sales
 WHERE a~xblnr EQ g_it_sales-vbeln_dlv.
  IF sy-subrc EQ 0.
    SORT g_it_mkpf.
    SELECT mblnr
           mjahr
           matnr
           werks
           lgort
           erfmg
           erfme
           j_3asiz
           j_4ksca
  FROM mseg
  INTO TABLE g_it_mseg
  FOR ALL ENTRIES IN g_it_mkpf
  WHERE mblnr EQ g_it_mkpf-mblnr AND
        mjahr EQ g_it_mkpf-mjahr AND
        shkzg EQ 'S'.
    IF sy-subrc EQ 0.
      SORT g_it_mseg.
    ENDIF.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 11:21:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158780#M1977778</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-05-15T11:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158781#M1977779</link>
      <description>&lt;P&gt;I would keep the join and replace FOR ALL ENTRIES with GTT or other solution &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 17:06:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158781#M1977779</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-05-15T17:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158782#M1977780</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think you are trying to optimize the query as it might be taking time.You can proceed as  &lt;SPAN class="mention-scrubbed"&gt;satishkumarbalasubramanian&lt;/SPAN&gt; or &lt;SPAN class="mention-scrubbed"&gt;mateuszadamus&lt;/SPAN&gt; reply adding a delete adjacent duplicates before the first fetch on mkpf on basis of vbeln_dlv.&lt;BR /&gt;You can also try to find a way to use primary key so that time is reduced.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Abhishek&lt;/P&gt;</description>
      <pubDate>Sat, 16 May 2020 07:57:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158782#M1977780</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-05-16T07:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158783#M1977781</link>
      <description>&lt;P&gt;Thanks for your help Adamus &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 04:17:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158783#M1977781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-05-20T04:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting the Join condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158784#M1977782</link>
      <description>&lt;P&gt;Thanks for your help Satish &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 04:18:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/splitting-the-join-condition/m-p/12158784#M1977782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-05-20T04:18:02Z</dc:date>
    </item>
  </channel>
</rss>

