<?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: optimization select query... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191765#M1374759</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi chetan teli,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Try this:&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; SELECT belnr bukrs gjahr awkey blart &lt;/P&gt;&lt;P&gt;&amp;gt;    FROM bkpf&lt;/P&gt;&lt;P&gt;&amp;gt;      INTO TABLE t_bkpf&lt;/P&gt;&lt;P&gt;&amp;gt;   WHERE bukrs IN s_bukrs&lt;/P&gt;&lt;P&gt;&amp;gt;        &lt;STRONG&gt;AND belnr GT 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;        AND gjahr IN r_year.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Add belnr in the Where condition to use the full primary key.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; José&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Doing this is not going to make a lot of difference to the amount of data the query will have to search through if, like us, you have a very small number of BUKRS values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Oct 2009 14:47:04 GMT</pubDate>
    <dc:creator>christine_evans</dc:creator>
    <dc:date>2009-10-13T14:47:04Z</dc:date>
    <item>
      <title>optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191758#M1374752</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;The below select query is causing performance issue in production , it is taking much time. &lt;/P&gt;&lt;P&gt;Please suggest how to optimize it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT belnr bukrs gjahr awkey blart FROM bkpf&lt;/P&gt;&lt;P&gt; INTO TABLE t_bkpf&lt;/P&gt;&lt;P&gt;         WHERE bukrs IN s_bukrs AND&lt;/P&gt;&lt;P&gt;               gjahr IN r_year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;chetan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - Please see &lt;SPAN __jive_macro_name="thread" id="1283414"&gt;&lt;/SPAN&gt; before posting - post locked&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Oct 13, 2009 10:49 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Oct 2009 09:13:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191758#M1374752</guid>
      <dc:creator>former_member192432</dc:creator>
      <dc:date>2009-10-10T09:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191759#M1374753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chetan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest the following to optimize your performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Change the order of the fields (belnr bukrs gjahr awkey blart), so that they're in the same order than showned in SE11 table data definition (you may need to change the order in t_bkpf definiton also).&lt;/P&gt;&lt;P&gt;- Add the client in your select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT bukrs belnr gjahr blart awkey FROM bkpf CLIENT SPECIFIED
INTO TABLE t_bkpf
WHERE mandt = sy-mandt
AND bukrs IN s_bukrs 
AND gjahr IN r_year.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your statement it's very simple. I don't think that there is much more to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Bruno Garcia on Oct 10, 2009 10:48 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Oct 2009 10:45:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191759#M1374753</guid>
      <dc:creator>BGarcia</dc:creator>
      <dc:date>2009-10-10T10:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191760#M1374754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chetan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think your code is perfect..as Bruno replied there is nothing much to change because it will use primary index of BKPF table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only one thing you need to check is that make sure that S_bukrs and R_year have values..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this reply helps you..:)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Basavaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Oct 2009 16:42:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191760#M1374754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-10T16:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191761#M1374755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chetan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to give maximum possible key fieds in where condition.If possible give BELNR(Accounting document number) also in where condition.Otherwise u can go with Bruno statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Pydi Reddy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 05:44:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191761#M1374755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T05:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191762#M1374756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; - Add the client in your select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you ever hear about the automatic client addition? This recommendation is nonsense! and should not be done!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 06:53:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191762#M1374756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T06:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191763#M1374757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the problem is related to the select-options!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; WHERE bukrs IN s_bukrs AND&lt;/P&gt;&lt;P&gt;&amp;gt; gjahr IN r_year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Be aware that these are dynamic conditions, only at runtime they aree filled, and they can be empty (non-selective) or&lt;/P&gt;&lt;P&gt;very limiting. So you must check the actual content if you want to figure out the cause of your problem.&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, 12 Oct 2009 06:56:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191763#M1374757</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T06:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191764#M1374758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi chetan teli,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT belnr bukrs gjahr awkey blart &lt;/P&gt;&lt;P&gt;   FROM bkpf&lt;/P&gt;&lt;P&gt;     INTO TABLE t_bkpf&lt;/P&gt;&lt;P&gt;  WHERE bukrs IN s_bukrs&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AND belnr GT 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       AND gjahr IN r_year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add belnr in the Where condition to use the full primary key.&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;José&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2009 14:17:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191764#M1374758</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-13T14:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: optimization select query...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191765#M1374759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi chetan teli,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Try this:&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; SELECT belnr bukrs gjahr awkey blart &lt;/P&gt;&lt;P&gt;&amp;gt;    FROM bkpf&lt;/P&gt;&lt;P&gt;&amp;gt;      INTO TABLE t_bkpf&lt;/P&gt;&lt;P&gt;&amp;gt;   WHERE bukrs IN s_bukrs&lt;/P&gt;&lt;P&gt;&amp;gt;        &lt;STRONG&gt;AND belnr GT 0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;        AND gjahr IN r_year.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Add belnr in the Where condition to use the full primary key.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; José&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Doing this is not going to make a lot of difference to the amount of data the query will have to search through if, like us, you have a very small number of BUKRS values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2009 14:47:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimization-select-query/m-p/6191765#M1374759</guid>
      <dc:creator>christine_evans</dc:creator>
      <dc:date>2009-10-13T14:47:04Z</dc:date>
    </item>
  </channel>
</rss>

