<?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: question regarding select staments in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859423#M670517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phaninder , &lt;/P&gt;&lt;P&gt;  Joins are prefered as in case of joins the filtering of data is done at the database level and there is only once call to the database , but in the case of nested select there will be multipl database calls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagdrs&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Sep 2007 06:42:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-27T06:42:52Z</dc:date>
    <item>
      <title>question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859419#M670513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Every one ,&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;   which one is better to use ....&lt;/P&gt;&lt;P&gt;   Nested Select staments or Inner Joins .... performance issue ...and which one is more suggestable...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PHANINDER&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:31:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859419#M670513</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T06:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859420#M670514</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;&lt;/P&gt;&lt;P&gt;Both of them affect the performance. So it is not adviced to use them. Try to use FOR ALL ENTRIES. &lt;/P&gt;&lt;P&gt;Check these links for more information &lt;/P&gt;&lt;P&gt;&lt;A href="http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_Introduction.asp" target="test_blank"&gt;http://www.thespot4sap.com/Articles/SAPABAPPerformanceTuning_Introduction.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm" target="test_blank"&gt;http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/abap/performance.htm#Modifying%20a%20set%20of%20lines" target="test_blank"&gt;http://www.erpgenie.com/abap/performance.htm#Modifying%20a%20set%20of%20lines&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://ezinearticles.com/?SAP-ABAP-Performance-Tuning-Tips-and-Tricks&amp;amp;id=294417" target="test_blank"&gt;http://ezinearticles.com/?SAP-ABAP-Performance-Tuning-Tips-and-Tricks&amp;amp;id=294417&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&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;Priyanka.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:39:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859420#M670514</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T06:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859421#M670515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Phani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From a performance point of view, neither nested SELECTs or JOINS are advisable, &amp;lt;b&amp;gt;unless there is no other option&amp;lt;/b&amp;gt;. Instead do individual and limited SELECTs into different tables sequentially, using FOR ALL ENTRIES and bind your output data into your final OP itab after all ut data is retrieved thru individual SELECTs. Ensurre the WHERE conditions are on the PKeys or Indices and also check the order of fields in the WHERE condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helpful,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:39:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859421#M670515</guid>
      <dc:creator>former_member189629</dc:creator>
      <dc:date>2007-09-27T06:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859422#M670516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;inner join is always better than nested selectes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regarding better performance techniques, u can see tips and tricks in the tcode se30.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:41:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859422#M670516</guid>
      <dc:creator>hymavathi_oruganti</dc:creator>
      <dc:date>2007-09-27T06:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859423#M670517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phaninder , &lt;/P&gt;&lt;P&gt;  Joins are prefered as in case of joins the filtering of data is done at the database level and there is only once call to the database , but in the case of nested select there will be multipl database calls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagdrs&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:42:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859423#M670517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T06:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859424#M670518</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;For better performance you should use &amp;lt;b&amp;gt;inner join&amp;lt;/b&amp;gt; and at the same time you can use &amp;lt;b&amp;gt;for all entries&amp;lt;/b&amp;gt; also. But never get into nested select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to SE30 in that you can have tips and tricks button for better performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:43:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859424#M670518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T06:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859425#M670519</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;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;Nested selects&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The plus:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Small amount of data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mixing processing and reading of data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Easy to code - and understand &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The minus:&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Large amount of data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when mixed processing isn&amp;#146;t needed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance killer no. 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;Select using JOINS&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The plus&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Very large amount of data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similar to Nested selects - when the accesses are planned by the programmer &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases the fastest &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not so memory critical &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The minus&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Very difficult to program/understand &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mixing processing and reading of data not possible &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bhaskar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:45:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859425#M670519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T06:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding select staments</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859426#M670520</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;i am giving you the select statements peformance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Select Statements   Select Queries&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.	Avoid nested selects&lt;/P&gt;&lt;P&gt;2.	Select all the records in a single shot using into table clause of select statement rather than to use Append statements. &lt;/P&gt;&lt;P&gt;3.	When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index. &lt;/P&gt;&lt;P&gt;4.	For testing existence , use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit.  &lt;/P&gt;&lt;P&gt;5.	Use Select Single if all primary key fields are supplied in the Where condition .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 1&lt;/P&gt;&lt;P&gt;SELECT * FROM EKKO INTO EKKO_WA.&lt;/P&gt;&lt;P&gt;  SELECT * FROM EKAN INTO EKAN_WA&lt;/P&gt;&lt;P&gt;      WHERE EBELN = EKKO_WA-EBELN.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;The above code can be much more optimized by the code written below.&lt;/P&gt;&lt;P&gt;SELECT P&lt;SUB&gt;F1 P&lt;/SUB&gt;F2 F&lt;SUB&gt;F3 F&lt;/SUB&gt;F4 INTO TABLE ITAB&lt;/P&gt;&lt;P&gt;    FROM EKKO AS P INNER JOIN EKAN AS F&lt;/P&gt;&lt;P&gt;      ON P&lt;SUB&gt;EBELN = F&lt;/SUB&gt;EBELN.&lt;/P&gt;&lt;P&gt;Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops  only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK INTO SBOOK_WA.&lt;/P&gt;&lt;P&gt;  CHECK: SBOOK_WA-CARRID = 'LH' AND&lt;/P&gt;&lt;P&gt;         SBOOK_WA-CONNID = '0400'.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table&lt;/P&gt;&lt;P&gt;SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK&lt;/P&gt;&lt;P&gt;  WHERE SBOOK_WA-CARRID = 'LH' AND&lt;/P&gt;&lt;P&gt;              SBOOK_WA-CONNID = '0400'.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 3&lt;/P&gt;&lt;P&gt;To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields . In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 4&lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK INTO SBOOK_WA&lt;/P&gt;&lt;P&gt;  UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;  WHERE CARRID = 'LH'.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;The above code is more optimized as compared to the code mentioned below for testing existence of a record.&lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK INTO SBOOK_WA&lt;/P&gt;&lt;P&gt;    WHERE CARRID = 'LH'.&lt;/P&gt;&lt;P&gt;  EXIT.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 5&lt;/P&gt;&lt;P&gt;If all primary key fields are supplied in the Where condition you can even use Select Single. &lt;/P&gt;&lt;P&gt;Select Single requires one communication with the database system, whereas Select-Endselect needs two. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Select Statements           contd..  SQL Interface&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.	Use column updates instead of single-row updates &lt;/P&gt;&lt;P&gt;to update your database tables.&lt;/P&gt;&lt;P&gt;2.	For all frequently used Select statements, try to use an index.&lt;/P&gt;&lt;P&gt;3.	Using buffered tables improves the performance considerably.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 1&lt;/P&gt;&lt;P&gt;SELECT * FROM SFLIGHT INTO SFLIGHT_WA.&lt;/P&gt;&lt;P&gt;  SFLIGHT_WA-SEATSOCC =&lt;/P&gt;&lt;P&gt;    SFLIGHT_WA-SEATSOCC - 1.&lt;/P&gt;&lt;P&gt;  UPDATE SFLIGHT FROM SFLIGHT_WA.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;The above mentioned code can be more optimized by using the following code&lt;/P&gt;&lt;P&gt;UPDATE SFLIGHT&lt;/P&gt;&lt;P&gt;       SET SEATSOCC = SEATSOCC - 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 2&lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA&lt;/P&gt;&lt;P&gt;  WHERE CARRID = 'LH'&lt;/P&gt;&lt;P&gt;    AND CONNID = '0400'.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;The above mentioned code can be more optimized by using the following code&lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA&lt;/P&gt;&lt;P&gt;  WHERE MANDT IN ( SELECT MANDT FROM T000 )&lt;/P&gt;&lt;P&gt;    AND CARRID = 'LH'&lt;/P&gt;&lt;P&gt;    AND CONNID = '0400'.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Point # 3&lt;/P&gt;&lt;P&gt;Bypassing the buffer increases the network considerably&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM T100 INTO T100_WA&lt;/P&gt;&lt;P&gt;  BYPASSING BUFFER&lt;/P&gt;&lt;P&gt;  WHERE     SPRSL = 'D'&lt;/P&gt;&lt;P&gt;        AND ARBGB = '00'&lt;/P&gt;&lt;P&gt;        AND MSGNR = '999'.&lt;/P&gt;&lt;P&gt;The above mentioned code can be more optimized by using the following code&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM T100  INTO T100_WA&lt;/P&gt;&lt;P&gt;  WHERE     SPRSL = 'D'&lt;/P&gt;&lt;P&gt;        AND ARBGB = '00'&lt;/P&gt;&lt;P&gt;        AND MSGNR = '999'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Select Statements    contd&amp;#133;For All Entries&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause. &lt;/P&gt;&lt;P&gt;	The plus &lt;/P&gt;&lt;P&gt;&amp;#149;	Large amount of data &lt;/P&gt;&lt;P&gt;&amp;#149;	Mixing processing and reading of data &lt;/P&gt;&lt;P&gt;&amp;#149;	Fast internal reprocessing of data &lt;/P&gt;&lt;P&gt;&amp;#149;	Fast &lt;/P&gt;&lt;P&gt;	The Minus &lt;/P&gt;&lt;P&gt;&amp;#149;	Difficult to program/understand &lt;/P&gt;&lt;P&gt;&amp;#149;	Memory could be critical (use FREE or PACKAGE size) &lt;/P&gt;&lt;P&gt;	&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;Points to be must considered FOR ALL ENTRIES&amp;lt;/u&amp;gt; &amp;#149;	Check that data is present in the driver table&lt;/P&gt;&lt;P&gt;&amp;#149;	Sorting the driver table &lt;/P&gt;&lt;P&gt;&amp;#149;	Removing duplicates from the driver table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the following piece of extract&lt;/P&gt;&lt;P&gt; Loop at int_cntry.&lt;/P&gt;&lt;P&gt;       Select single * from zfligh into int_fligh&lt;/P&gt;&lt;P&gt; where cntry = int_cntry-cntry.&lt;/P&gt;&lt;P&gt; Append int_fligh. &lt;/P&gt;&lt;P&gt; Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above mentioned can be more optimized by using the following code.&lt;/P&gt;&lt;P&gt;Sort int_cntry by cntry.&lt;/P&gt;&lt;P&gt;Delete adjacent duplicates from int_cntry.&lt;/P&gt;&lt;P&gt;If NOT int_cntry[] is INITIAL.&lt;/P&gt;&lt;P&gt;            Select * from zfligh appending table int_fligh&lt;/P&gt;&lt;P&gt;            For all entries in int_cntry &lt;/P&gt;&lt;P&gt;            Where cntry = int_cntry-cntry.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;finally compared to nested select , joins , for all entries &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the performance is better in this path &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;nested selest  -&amp;gt; joins -&amp;gt; for all entries&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if usefull&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 06:51:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/question-regarding-select-staments/m-p/2859426#M670520</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T06:51:17Z</dc:date>
    </item>
  </channel>
</rss>

