<?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: Select Statements in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201196#M470342</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; refer this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nilesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 May 2007 13:10:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-04T13:10:35Z</dc:date>
    <item>
      <title>Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201192#M470338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need some tips and tricks on select statements with all performance issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:03:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201192#M470338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-04T13:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201193#M470339</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;refer to the following link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/abap/performance.htm" target="test_blank"&gt;http://www.erpgenie.com/abap/performance.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Sipra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:06:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201193#M470339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-04T13:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201194#M470340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;1) Dont use nested seelct statement&lt;/P&gt;&lt;P&gt;2) If possible use for all entries in addition&lt;/P&gt;&lt;P&gt;3) In the where addition make sure you give all the primary key&lt;/P&gt;&lt;P&gt;4) Use Index for the selection criteria.&lt;/P&gt;&lt;P&gt;5) You can also use inner joins&lt;/P&gt;&lt;P&gt;6) You can try to put the data from the first select statement into an Itab and then in order to select the data from the second table use for all entries in.&lt;/P&gt;&lt;P&gt;7) Use the runtime analysis SE30 and SQL Trace (ST05) to identify the performance and also to identify where the load is heavy, so that you can change the code accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234" target="test_blank"&gt;https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0db4c9-0e01-0010-b68f-9b1408d5f234&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:07:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201194#M470340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-04T13:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201195#M470341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Go to any report (SE38) - Select menu Environment and Performance Examples.&lt;/P&gt;&lt;P&gt;You will find all performance examples for select as well as loop and others.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Nilesh Shete&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:08:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201195#M470341</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-04T13:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201196#M470342</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; refer this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/62/10a423384746e8bf5f15ccdd36e8b1/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nilesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:10:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201196#M470342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-04T13:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201197#M470343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Debabrata,&lt;/P&gt;&lt;P&gt;                      The Open SQL statement for reading data from database tables is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT    &amp;lt;result&amp;gt; &lt;/P&gt;&lt;P&gt;INTO      &amp;lt;target&amp;gt;&lt;/P&gt;&lt;P&gt;FROM      &amp;lt;source&amp;gt; &lt;/P&gt;&lt;P&gt;[WHERE    &amp;lt;condition&amp;gt;]&lt;/P&gt;&lt;P&gt;[GROUP BY &amp;lt;fields&amp;gt;] &lt;/P&gt;&lt;P&gt;[HAVING   &amp;lt;cond&amp;gt;]&lt;/P&gt;&lt;P&gt;[ORDER BY &amp;lt;fields&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SELECT statement is divided into a series of simple clauses, each of which has a different part to play in selecting, placing, and arranging the data from the database.&lt;/P&gt;&lt;P&gt;Clause&lt;/P&gt;&lt;P&gt; Description&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;SELECT &amp;lt;result&amp;gt;&lt;/P&gt;&lt;P&gt; The SELECT clause defines the structure of the data you want to read, that is, whether one line or several, which columns you want to read, and whether identical entries are acceptable or not.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;INTO &amp;lt;target&amp;gt;&lt;/P&gt;&lt;P&gt; The INTO clause determines the target area &amp;lt;target&amp;gt; into which the selected data is to be read. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;FROM &amp;lt;source&amp;gt;&lt;/P&gt;&lt;P&gt; The FROM clause specifies the database table or view &amp;lt;source&amp;gt; from which the data is to be selected. It can also be placed before the INTO clause.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;WHERE &amp;lt;cond&amp;gt;&lt;/P&gt;&lt;P&gt; The WHERE clause specifies which lines are to be read by specifying conditions for the selection. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;GROUP BY &amp;lt;fields&amp;gt;&lt;/P&gt;&lt;P&gt; The GROUP-BY clause produces a single line of results from groups of several lines. A group is a set of lines with identical values for each column listed in &amp;lt;fields&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;HAVING &amp;lt;cond&amp;gt;&lt;/P&gt;&lt;P&gt; The HAVING clause sets logical conditions for the lines combined using GROUP BY.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ORDER BY &amp;lt;cond&amp;gt;&lt;/P&gt;&lt;P&gt; The ORDER-BY clause defines a sequence &amp;lt;fields&amp;gt; for the lines resulting from the selection.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The individual clauses and the ways in which they combine are all very important factors in the SELECT statement. Although it is a single statement like any other, beginning with the SELECT keyword and ending with a period, its division into clauses, and the ways in which they combine, make it more powerful than other statements. A single SELECT statement can perform functions ranging from simply reading a single line to executing a very complicated database query. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use SELECT statements in the WHERE and HAVING clauses. These are called subqueries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can decouple the INTO clause from the SELECT statement by reading from the database using a cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hemant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:10:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201197#M470343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-04T13:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201198#M470344</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;Check this info:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance tuning for Data Selection Statement  &lt;/P&gt;&lt;P&gt;For all entries&lt;/P&gt;&lt;P&gt;The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of  &lt;/P&gt;&lt;P&gt;entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the  &lt;/P&gt;&lt;P&gt;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;Some steps that might make FOR ALL ENTRIES more efficient: &lt;/P&gt;&lt;P&gt;&amp;#149;	Removing duplicates from the the driver table  &lt;/P&gt;&lt;P&gt;&amp;#149;	Sorting the driver table  &lt;/P&gt;&lt;P&gt;If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement: &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN i_tab &lt;/P&gt;&lt;P&gt;  WHERE mykey &amp;gt;= i_tab-low and &lt;/P&gt;&lt;P&gt;        mykey &amp;lt;= i_tab-high.&lt;/P&gt;&lt;P&gt;Nested selects&lt;/P&gt;&lt;P&gt;The plus: &lt;/P&gt;&lt;P&gt;&amp;#149;	Small 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;	Easy to code - and understand  &lt;/P&gt;&lt;P&gt;The minus: &lt;/P&gt;&lt;P&gt;&amp;#149;	Large amount of data  &lt;/P&gt;&lt;P&gt;&amp;#149;	when mixed processing isn&amp;#146;t needed  &lt;/P&gt;&lt;P&gt;&amp;#149;	Performance killer no. 1 &lt;/P&gt;&lt;P&gt;Select using JOINS&lt;/P&gt;&lt;P&gt;The plus &lt;/P&gt;&lt;P&gt;&amp;#149;	Very large amount of data  &lt;/P&gt;&lt;P&gt;&amp;#149;	Similar to Nested selects - when the accesses are planned by the programmer  &lt;/P&gt;&lt;P&gt;&amp;#149;	In some cases the fastest  &lt;/P&gt;&lt;P&gt;&amp;#149;	Not so memory critical  &lt;/P&gt;&lt;P&gt;The minus &lt;/P&gt;&lt;P&gt;&amp;#149;	Very difficult to program/understand  &lt;/P&gt;&lt;P&gt;&amp;#149;	Mixing processing and reading of data not possible  &lt;/P&gt;&lt;P&gt;Use the selection criteria &lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK.                    &lt;/P&gt;&lt;P&gt;  CHECK: SBOOK-CARRID = 'LH' AND        &lt;/P&gt;&lt;P&gt;                  SBOOK-CONNID = '0400'.         &lt;/P&gt;&lt;P&gt;ENDSELECT.                              &lt;/P&gt;&lt;P&gt;SELECT * FROM SBOOK                      &lt;/P&gt;&lt;P&gt;  WHERE CARRID = 'LH' AND                &lt;/P&gt;&lt;P&gt;        CONNID = '0400'.                 &lt;/P&gt;&lt;P&gt;ENDSELECT.                               &lt;/P&gt;&lt;P&gt;Use the aggregated functions &lt;/P&gt;&lt;P&gt;C4A = '000'.               &lt;/P&gt;&lt;P&gt;SELECT * FROM T100         &lt;/P&gt;&lt;P&gt;  WHERE SPRSL = 'D' AND    &lt;/P&gt;&lt;P&gt;        ARBGB = '00'.      &lt;/P&gt;&lt;P&gt;  CHECK: T100-MSGNR &amp;gt; C4A. &lt;/P&gt;&lt;P&gt;  C4A = T100-MSGNR.        &lt;/P&gt;&lt;P&gt;ENDSELECT.                 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT MAX( MSGNR ) FROM T100 INTO C4A  &lt;/P&gt;&lt;P&gt; WHERE SPRSL = 'D' AND                 &lt;/P&gt;&lt;P&gt;       ARBGB = '00'.                   &lt;/P&gt;&lt;P&gt;Select with view&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01L                     &lt;/P&gt;&lt;P&gt;  WHERE DOMNAME LIKE 'CHAR%'            &lt;/P&gt;&lt;P&gt;        AND AS4LOCAL = 'A'.             &lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM DD01T            &lt;/P&gt;&lt;P&gt;    WHERE   DOMNAME    = DD01L-DOMNAME  &lt;/P&gt;&lt;P&gt;        AND AS4LOCAL   = 'A'            &lt;/P&gt;&lt;P&gt;        AND AS4VERS    = DD01L-AS4VERS  &lt;/P&gt;&lt;P&gt;        AND DDLANGUAGE = SY-LANGU.      &lt;/P&gt;&lt;P&gt;ENDSELECT.                              &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01V                     &lt;/P&gt;&lt;P&gt; WHERE DOMNAME LIKE 'CHAR%'            &lt;/P&gt;&lt;P&gt;       AND DDLANGUAGE = SY-LANGU.      &lt;/P&gt;&lt;P&gt;ENDSELECT.                              &lt;/P&gt;&lt;P&gt;Select with index support&lt;/P&gt;&lt;P&gt;SELECT * FROM T100             &lt;/P&gt;&lt;P&gt; WHERE     ARBGB = '00'       &lt;/P&gt;&lt;P&gt;       AND MSGNR = '999'.     &lt;/P&gt;&lt;P&gt;ENDSELECT.                     &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM T002.              &lt;/P&gt;&lt;P&gt;  SELECT * FROM T100             &lt;/P&gt;&lt;P&gt;    WHERE     SPRSL = T002-SPRAS &lt;/P&gt;&lt;P&gt;          AND ARBGB = '00'       &lt;/P&gt;&lt;P&gt;          AND MSGNR = '999'.     &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;Select &amp;#133; Into table&lt;/P&gt;&lt;P&gt;REFRESH X006.                  &lt;/P&gt;&lt;P&gt;SELECT * FROM T006 INTO X006.  &lt;/P&gt;&lt;P&gt;  APPEND X006.                 &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM T006 INTO TABLE X006.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select with selection list&lt;/P&gt;&lt;P&gt;SELECT * FROM DD01L               &lt;/P&gt;&lt;P&gt;  WHERE DOMNAME LIKE 'CHAR%'      &lt;/P&gt;&lt;P&gt;        AND AS4LOCAL = 'A'.       &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DOMNAME FROM DD01L     &lt;/P&gt;&lt;P&gt; INTO DD01L-DOMNAME          &lt;/P&gt;&lt;P&gt; WHERE DOMNAME LIKE 'CHAR%'  &lt;/P&gt;&lt;P&gt;       AND AS4LOCAL = 'A'.   &lt;/P&gt;&lt;P&gt;ENDSELECT&lt;/P&gt;&lt;P&gt;Key access to multiple lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB.           &lt;/P&gt;&lt;P&gt; CHECK TAB-K = KVAL.  &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;LOOP AT TAB WHERE K = KVAL.      &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;Copying internal tables&lt;/P&gt;&lt;P&gt;REFRESH TAB_DEST.               &lt;/P&gt;&lt;P&gt;LOOP AT TAB_SRC INTO TAB_DEST.  &lt;/P&gt;&lt;P&gt;  APPEND TAB_DEST.              &lt;/P&gt;&lt;P&gt;ENDLOOP.                        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB_DEST[] = TAB_SRC[].&lt;/P&gt;&lt;P&gt;Modifying a set of lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB.              &lt;/P&gt;&lt;P&gt;  IF TAB-FLAG IS INITIAL. &lt;/P&gt;&lt;P&gt;    TAB-FLAG = 'X'.       &lt;/P&gt;&lt;P&gt;  ENDIF.                  &lt;/P&gt;&lt;P&gt;  MODIFY TAB.             &lt;/P&gt;&lt;P&gt;ENDLOOP.                  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TAB-FLAG = 'X'.                   &lt;/P&gt;&lt;P&gt;MODIFY TAB TRANSPORTING FLAG      &lt;/P&gt;&lt;P&gt;           WHERE FLAG IS INITIAL. &lt;/P&gt;&lt;P&gt;Deleting a sequence of lines&lt;/P&gt;&lt;P&gt;DO 101 TIMES.                &lt;/P&gt;&lt;P&gt;  DELETE TAB_DEST INDEX 450. &lt;/P&gt;&lt;P&gt;ENDDO.                       &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TAB_DEST FROM 450 TO 550.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Linear search vs. binary&lt;/P&gt;&lt;P&gt;READ TABLE TAB WITH KEY K = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.&lt;/P&gt;&lt;P&gt;Comparison of internal tables&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE: TAB1 LINES L1,       &lt;/P&gt;&lt;P&gt;                TAB2 LINES L2.       &lt;/P&gt;&lt;P&gt;                                     &lt;/P&gt;&lt;P&gt;IF L1 &amp;lt;&amp;gt; L2.                         &lt;/P&gt;&lt;P&gt;  TAB_DIFFERENT = 'X'.               &lt;/P&gt;&lt;P&gt;ELSE.                                &lt;/P&gt;&lt;P&gt;  TAB_DIFFERENT = SPACE.             &lt;/P&gt;&lt;P&gt;  LOOP AT TAB1.                      &lt;/P&gt;&lt;P&gt;    READ TABLE TAB2 INDEX SY-TABIX.  &lt;/P&gt;&lt;P&gt;    IF TAB1 &amp;lt;&amp;gt; TAB2.                 &lt;/P&gt;&lt;P&gt;      TAB_DIFFERENT = 'X'. EXIT.     &lt;/P&gt;&lt;P&gt;    ENDIF.                           &lt;/P&gt;&lt;P&gt;  ENDLOOP.                           &lt;/P&gt;&lt;P&gt;ENDIF.                               &lt;/P&gt;&lt;P&gt;                                     &lt;/P&gt;&lt;P&gt;IF TAB_DIFFERENT = SPACE.            &lt;/P&gt;&lt;P&gt;  " ...                              &lt;/P&gt;&lt;P&gt;ENDIF.                               &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF TAB1[] = TAB2[].   &lt;/P&gt;&lt;P&gt; " ...               &lt;/P&gt;&lt;P&gt;ENDIF.                &lt;/P&gt;&lt;P&gt;Modify selected components&lt;/P&gt;&lt;P&gt;LOOP AT TAB.            &lt;/P&gt;&lt;P&gt; TAB-DATE = SY-DATUM.  &lt;/P&gt;&lt;P&gt; MODIFY TAB.           &lt;/P&gt;&lt;P&gt;ENDLOOP.                &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WA-DATE = SY-DATUM.                     &lt;/P&gt;&lt;P&gt;LOOP AT TAB.                            &lt;/P&gt;&lt;P&gt; MODIFY TAB FROM WA TRANSPORTING DATE. &lt;/P&gt;&lt;P&gt;ENDLOOP.                                &lt;/P&gt;&lt;P&gt;Appending two internal tables&lt;/P&gt;&lt;P&gt;LOOP AT TAB_SRC.               &lt;/P&gt;&lt;P&gt;  APPEND TAB_SRC TO TAB_DEST.  &lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF TAB_SRC TO TAB_DEST.&lt;/P&gt;&lt;P&gt;Deleting a set of lines&lt;/P&gt;&lt;P&gt;LOOP AT TAB_DEST WHERE K = KVAL.  &lt;/P&gt;&lt;P&gt;  DELETE TAB_DEST.                &lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE TAB_DEST WHERE K = KVAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tools available in SAP to pin-point a performance problem&lt;/P&gt;&lt;P&gt;The runtime analysis (SE30)&lt;/P&gt;&lt;P&gt;SQL Trace (ST05)&lt;/P&gt;&lt;P&gt;Tips and Tricks tool &lt;/P&gt;&lt;P&gt;The performance database&lt;/P&gt;&lt;P&gt;Optimizing the load of the database&lt;/P&gt;&lt;P&gt;Using table buffering&lt;/P&gt;&lt;P&gt;Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are: &lt;/P&gt;&lt;P&gt;&amp;#149;	Select DISTINCT  &lt;/P&gt;&lt;P&gt;&amp;#149;	ORDER BY / GROUP BY / HAVING clause  &lt;/P&gt;&lt;P&gt;&amp;#149;	Any WHERE clasuse that contains a subquery or IS NULL expression  &lt;/P&gt;&lt;P&gt;&amp;#149;	JOIN s  &lt;/P&gt;&lt;P&gt;&amp;#149;	A SELECT... FOR UPDATE  &lt;/P&gt;&lt;P&gt;If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECT clause. &lt;/P&gt;&lt;P&gt;Use the ABAP SORT Clause Instead of ORDER BY&lt;/P&gt;&lt;P&gt;The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server. &lt;/P&gt;&lt;P&gt;If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it. &lt;/P&gt;&lt;P&gt;Avoid ther SELECT DISTINCT Statement&lt;/P&gt;&lt;P&gt;As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this would be helpful to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kumar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:15:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201198#M470344</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-04T13:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Select Statements</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201199#M470345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Debabrata,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer to this link it contains all code optimizing techniqes which you can have for select statements &lt;/P&gt;&lt;P&gt;&lt;A href="http://sapbrain.com/ARTICLES/TECHNICAL/optimization/optimization.html" target="test_blank"&gt;http://sapbrain.com/ARTICLES/TECHNICAL/optimization/optimization.html&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;&amp;lt;i&amp;gt;If it serves your purpose  then reward points for the same .&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amber S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2007 13:18:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statements/m-p/2201199#M470345</guid>
      <dc:creator>former_member198270</dc:creator>
      <dc:date>2007-05-04T13:18:36Z</dc:date>
    </item>
  </channel>
</rss>

