<?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: Performance of SELECT statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405167#M1046998</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;This Select statement is taking much time because you are using SELECT .......ENDSELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And also use If the internal table is not Initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT atinn FROM cabn INTO r_atinn-low&lt;/P&gt;&lt;P&gt;WHERE atkla = lc_chargrp_dim&lt;/P&gt;&lt;P&gt;AND anzst LE 8.&lt;/P&gt;&lt;P&gt;APPEND r_atinn.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if r_atinn is not Initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM cabn INTO TABLE ij_cabn&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN r_atinn&lt;/P&gt;&lt;P&gt;WHERE atinn = r_atinn-low&lt;/P&gt;&lt;P&gt;ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if r_atinn is not Initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM cabnt INTO TABLE ij_cabnt&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN r_atinn&lt;/P&gt;&lt;P&gt;WHERE atinn = r_atinn-low&lt;/P&gt;&lt;P&gt;ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i did not get why are you using order by Primary key, rather &lt;STRONG&gt;Sort&lt;/STRONG&gt; the internal table after fetching the records in the Internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Sujit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Aug 2008 13:31:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-27T13:31:18Z</dc:date>
    <item>
      <title>Performance of SELECT statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405166#M1046997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following statements are consuming huge time in my system. Could you please give me your inputs on tuning these queries &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT atinn FROM cabn INTO r_atinn-low&lt;/P&gt;&lt;P&gt;                     WHERE atkla = lc_chargrp_dim&lt;/P&gt;&lt;P&gt;                     AND anzst LE 8.&lt;/P&gt;&lt;P&gt;  APPEND r_atinn.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM cabn INTO TABLE ij_cabn&lt;/P&gt;&lt;P&gt;              FOR ALL ENTRIES IN r_atinn&lt;/P&gt;&lt;P&gt;              WHERE atinn = r_atinn-low&lt;/P&gt;&lt;P&gt;              ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM cabnt INTO TABLE ij_cabnt&lt;/P&gt;&lt;P&gt;              FOR ALL ENTRIES IN r_atinn&lt;/P&gt;&lt;P&gt;              WHERE atinn = r_atinn-low&lt;/P&gt;&lt;P&gt;              ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Sudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 13:21:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405166#M1046997</guid>
      <dc:creator>sudha_naik</dc:creator>
      <dc:date>2008-08-27T13:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of SELECT statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405167#M1046998</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;This Select statement is taking much time because you are using SELECT .......ENDSELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And also use If the internal table is not Initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT atinn FROM cabn INTO r_atinn-low&lt;/P&gt;&lt;P&gt;WHERE atkla = lc_chargrp_dim&lt;/P&gt;&lt;P&gt;AND anzst LE 8.&lt;/P&gt;&lt;P&gt;APPEND r_atinn.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if r_atinn is not Initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM cabn INTO TABLE ij_cabn&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN r_atinn&lt;/P&gt;&lt;P&gt;WHERE atinn = r_atinn-low&lt;/P&gt;&lt;P&gt;ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if r_atinn is not Initial.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM cabnt INTO TABLE ij_cabnt&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN r_atinn&lt;/P&gt;&lt;P&gt;WHERE atinn = r_atinn-low&lt;/P&gt;&lt;P&gt;ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i did not get why are you using order by Primary key, rather &lt;STRONG&gt;Sort&lt;/STRONG&gt; the internal table after fetching the records in the Internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Sujit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 13:31:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405167#M1046998</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T13:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of SELECT statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405168#M1046999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM cabn INTO CORRESPONDING FIELDS OF TABLE it_target
         JOIN cabnt ON cabnt~atinn = cabn~atinn
                    AND cabnt~adzhl = cabn~adzhl
                    AND cabnt~spras = sy-langu
          WHERE cabn~atkla = lc_chargrp_dim
            AND cabn~anzst LE 8.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Define it_target only with those fields from CABN and CABNT that you really need for further processing. There is an index on CABN-ATKLA, so this should be OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2008 13:31:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405168#M1046999</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-08-27T13:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of SELECT statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405169#M1047000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sudha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Try it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  ij_cabn like table of cabn,
  ij_cabnt like table of cabnt.

DATA:
  begin of wa_atinn,
    ATINN like CABN-ATINN,
  end of wa_atinn.

DATA:
  t_atinn like table of wa_atinn.


SELECT atinn FROM cabn INTO TABLE t_atinn
WHERE atkla = lc_chargrp_dim
AND anzst LE 8.


If t_atinn not initial.

SELECT * FROM cabn INTO TABLE ij_cabn
FOR ALL ENTRIES IN t_atinn
WHERE atinn EQ t_atinn-atinn
ORDER BY PRIMARY KEY.

SELECT * FROM cabnt INTO TABLE ij_cabnt
FOR ALL ENTRIES IN t_atinn
WHERE atinn EQ t_atinn-atinn
ORDER BY PRIMARY KEY.

endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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>Wed, 27 Aug 2008 13:35:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405169#M1047000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-27T13:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of SELECT statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405170#M1047001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sudha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can  do the following things to improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)select all the key fields when you want to fetch entries from a table.&lt;/P&gt;&lt;P&gt;2) Do not use select and end select&lt;/P&gt;&lt;P&gt;3) Select the required fields alone and also in the order they are in the database&lt;/P&gt;&lt;P&gt;4) Sort the table and check if it is not initial before you use for all entries.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Sep 2008 11:29:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-select-statement/m-p/4405170#M1047001</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-04T11:29:03Z</dc:date>
    </item>
  </channel>
</rss>

