<?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: regarding nested selects........... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233936#M1010979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check the link you find a example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5576545"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5797275"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Aug 2008 11:13:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-21T11:13:54Z</dc:date>
    <item>
      <title>regarding nested selects...........</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233930#M1010973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; i want to use one query in that i have to use neseted selects.&lt;/P&gt;&lt;P&gt;can any one tel me example with considering performane also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;madhu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 11:10:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233930#M1010973</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T11:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: regarding nested selects...........</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233931#M1010974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi madhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT tabname&lt;/P&gt;&lt;P&gt;           INTO ls_dd02l&lt;/P&gt;&lt;P&gt;           FROM dd02l&lt;/P&gt;&lt;P&gt;           WHERE tabname LIKE c_feld&lt;/P&gt;&lt;P&gt;           AND   buffered IS NOT NULL.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      SELECT tabname fieldname keyflag position&lt;/P&gt;&lt;P&gt;             INTO CORRESPONDING FIELDS OF ls_dd03l&lt;/P&gt;&lt;P&gt;             FROM dd03l&lt;/P&gt;&lt;P&gt;             WHERE tabname   = ls_dd02l-tabname&lt;/P&gt;&lt;P&gt;             AND   fieldname IN ('MANDT', 'CLIENT', 'CLNT')&lt;/P&gt;&lt;P&gt;             AND   keyflag   = 'X'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        IF ( sy-subrc EQ 0 ).&lt;/P&gt;&lt;P&gt;          wa-tabname   = ls_dd03l-tabname.&lt;/P&gt;&lt;P&gt;          wa-fieldname = ls_dd03l-fieldname.&lt;/P&gt;&lt;P&gt;          wa-keyflag   = ls_dd03l-keyflag.&lt;/P&gt;&lt;P&gt;          wa-position  = ls_dd03l-position.&lt;/P&gt;&lt;P&gt;          APPEND wa TO itab.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDSELECT.&lt;/P&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are no practical limits to nested SELECTs, but as other repliers have already pointed out they quickly become a performance hog. I have stopped using them for years, and when I teach ABAP performance classes I also quote them as one of the top "don'ts". With nested selects, the number of calls to the DBMS can easily become enormous, putting the database server under stress. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A good alternative - the one I favour most myself - is to use SELECT INTO TABLE for the"outer" select, followed by appropriate SELECT FOR ALL ENTRIES statements to handle the inner levels. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABAP joins are another alternative. When properly written, a join will be faster than a nested select. The problem is however that very often joins are not properly written. SELECT statements should always respect the KISS principle (keep it simple, stupid) and with a join it is very easy to violate that rule. A join over 2 tables should probably be OK, but with 3 or more tables you want to be very careful. If you really want to code a complex join, I recommend that you also code the same logic with different means (INTO TABLE/FOR ALL ENTRIES or even nested selects) and then compare that with the join. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Jayan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 11:14:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233931#M1010974</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T11:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: regarding nested selects...........</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233932#M1010975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Instead of Nested selects use like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA&lt;/P&gt;&lt;P&gt;    WHERE SEATSOCC &amp;lt; F~SEATSMAX&lt;/P&gt;&lt;P&gt;      AND EXISTS ( SELECT * FROM SPFLI&lt;/P&gt;&lt;P&gt;                     WHERE CARRID = F~CARRID&lt;/P&gt;&lt;P&gt;                       AND CONNID = F~CONNID&lt;/P&gt;&lt;P&gt;                       AND CITYFROM = 'FRANKFURT'&lt;/P&gt;&lt;P&gt;                       AND CITYTO = 'NEW YORK' )&lt;/P&gt;&lt;P&gt;      AND FLDATE BETWEEN '19990101' AND '19990331'.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to SE30 and glick on Tips and Tricks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at SQL interface.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 11:15:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233932#M1010975</guid>
      <dc:creator>former_member585060</dc:creator>
      <dc:date>2008-08-11T11:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: regarding nested selects...........</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233933#M1010976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of using NESTED SQL statements use FOR ALL ENTRIES as far as performance is concerned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Murthy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 11:19:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233933#M1010976</guid>
      <dc:creator>former_member787646</dc:creator>
      <dc:date>2008-08-11T11:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: regarding nested selects...........</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233934#M1010977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nested selects should be avoided,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ If all tables are not buffered. If they are buffered, then the nested selects are the best solution!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ Joins should be the best alternative. But the performance of the joins should be checked (as everything) by the SQL trace. And maybe youe first version is not optimal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ For all entries can be an option, I would actually only recommend it, if the join does not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ the above mentioned subselect is a very special option, which can not always be used. But if it is applicable, then it can be the best solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Aug 2008 13:34:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233934#M1010977</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-11T13:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: regarding nested selects...........</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233935#M1010978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nested select can be avoided by using two internal table and merging those two internal tables into third itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select field into table itab1 from ekko &lt;/P&gt;&lt;P&gt;  where ebeln in s_ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select fields into table itab2 from ekpo&lt;/P&gt;&lt;P&gt;  for all entries in itab1 where&lt;/P&gt;&lt;P&gt;    ebeln = itab1-ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab1 into wa_itab1.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;  move-corresponding wa-tab1 to wa-final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  read table itab2 with key ebeln = it_header binary search transporting no fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at itab2 into wa_itab2 from sy-tabix.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  if itab2-ebeln &amp;lt;&amp;gt; itab1-ebeln.&lt;/P&gt;&lt;P&gt;    exit.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;    move-corresponding wa-tab2 to wa-final.&lt;/P&gt;&lt;P&gt;   append wa-final to itab_final .&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will avoid nested select and processing will be fast according to performance tuning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Shobhit Bansal on Aug 21, 2008 1:05 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2008 11:04:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233935#M1010978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-21T11:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: regarding nested selects...........</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233936#M1010979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check the link you find a example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5576545"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5797275"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Aug 2008 11:13:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-nested-selects/m-p/4233936#M1010979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-21T11:13:54Z</dc:date>
    </item>
  </channel>
</rss>

