<?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 issue on a select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227943#M1208564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try to provide MATNR WERKS  along with &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WHERE bstyp EQ 'K'
AND banfn EQ l_eban-banfn
AND bnfpo EQ l_eban-bnfpo.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Feb 2009 04:38:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-19T04:38:52Z</dc:date>
    <item>
      <title>Performance issue on a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227939#M1208560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all @ SAPforums and thanks for your attention,&lt;/P&gt;&lt;P&gt;the task is quite simple: given a Purchase Requisition number and position (banfn, bnfpo) I have to check if a contract with the same PR as source exists in the EKPO table.&lt;/P&gt;&lt;P&gt;In order to check for it, I simply typed the following select:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM EKPO INTO wa_checkekpo&lt;/P&gt;&lt;P&gt;      WHERE bstyp EQ 'K'&lt;/P&gt;&lt;P&gt;        AND banfn EQ l_eban-banfn&lt;/P&gt;&lt;P&gt;        AND bnfpo EQ l_eban-bnfpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This kind of query is quite consuming (more than three seconds in my process) due to the fact that banfn and bnfpo don't belong to a key for the table.&lt;/P&gt;&lt;P&gt;Any idea/workaround that can lead to better performance? Please note I'm not interested in retrieving the contract number (KONNR), it's sufficient to know it exists.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2009 12:44:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227939#M1208560</guid>
      <dc:creator>matteo_montalto</dc:creator>
      <dc:date>2009-02-18T12:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227940#M1208561</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;Do not use select * if you just want to check existence of the record. Use a single variable to store teh count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT count(*) FROM EKPO INTO lv_count
WHERE 
matnr = l_eban-matnr
and  bstyp EQ 'K'
AND banfn EQ l_eban-banfn
AND bnfpo EQ l_eban-bnfpo.
if lv_count &amp;gt; 0.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also use the material number if possible, so it uses the correct index, since you have it in the eban table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Advait Gode on Feb 18, 2009 1:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2009 12:55:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227940#M1208561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-18T12:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227941#M1208562</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;gt; Do not use select * if you just want to check existence of the record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so far so good. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Use a single variable to store teh count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But why should we count the records if we just want to know if a key exists in&lt;/P&gt;&lt;P&gt;the db or not? change the second half of the recommendation to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use a single field of the used index for the select list to check (sy-subrc or result&lt;/P&gt;&lt;P&gt;of that field) if the record exists or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2009 15:12:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227941#M1208562</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-02-18T15:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227942#M1208563</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;You can create an additional index for the given fields, using SE11 transaction. They will consume some extra storage place, but oh well... But a specialized index will greatly improve the performace...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Tamá&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2009 15:20:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227942#M1208563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-18T15:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on a select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227943#M1208564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try to provide MATNR WERKS  along with &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WHERE bstyp EQ 'K'
AND banfn EQ l_eban-banfn
AND bnfpo EQ l_eban-bnfpo.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Feb 2009 04:38:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-a-select-statement/m-p/5227943#M1208564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-19T04:38:52Z</dc:date>
    </item>
  </channel>
</rss>

