<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888300#M934035</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If u are looping at internal table say &lt;STRONG&gt;itab&lt;/STRONG&gt; and using select inside loop,then use :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &amp;lt;fiellds u want to select&amp;gt;&lt;/P&gt;&lt;P&gt; from &amp;lt;table name&amp;gt;&lt;/P&gt;&lt;P&gt; into table&amp;lt;internal table having fields u want to select&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;for all entreis in itab&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;where &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code .&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;Mukul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Jun 2008 09:05:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-05T09:05:25Z</dc:date>
    <item>
      <title>performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888296#M934031</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;In my program I have select statement inside loop-------endloop.How can I avoid this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hema&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:12:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888296#M934031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888297#M934032</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;if u r requirement is as ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at ta_bkpf.&lt;/P&gt;&lt;P&gt;select single&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from bsid&lt;/P&gt;&lt;P&gt;into table wa_bsid&lt;/P&gt;&lt;P&gt;where belnr = ta_bkpf.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;In this case: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose u have 1000 records in TA_BKPF &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select query for BSID table will trigger 1000 times &lt;/P&gt;&lt;P&gt;and will connect database system 1000 times.&lt;/P&gt;&lt;P&gt;so it may take time .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So instead of using above code u can use .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from BSID&lt;/P&gt;&lt;P&gt;into table TA_BSID&lt;/P&gt;&lt;P&gt;for all entries in TA_BKPF&lt;/P&gt;&lt;P&gt;where belnr = TA_BKPF-belnr.&lt;/P&gt;&lt;P&gt;it will connect database system only one time,&lt;/P&gt;&lt;P&gt;and it will work like case-1 also will take less time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but u have take care that if TA_BKPF is empty then &lt;/P&gt;&lt;P&gt;for all entries will fail and select query will fetch all data &lt;/P&gt;&lt;P&gt;from BSID to TA_BSID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so check TA_BKPF[] is initail or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;SImha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:20:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888297#M934032</guid>
      <dc:creator>Simha_</dc:creator>
      <dc:date>2008-06-04T10:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888298#M934033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;before other people comment differently, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is only a performance issue if a runtime measurement tells you that the statement is slow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So run the SQL trace first:&lt;/P&gt;&lt;P&gt;SQL trace:&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy&lt;/P&gt;&lt;P&gt;Read this carefully.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this statement the slowest in the list? How long does it need? Less than 10ms or more?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe the table is buffered and the select is not on the list at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe there are some other statement, which are much slower!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In general, you can move the select out of a loop, if you use &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES:&lt;/P&gt;&lt;P&gt;+ but never forget to check whether the table is empty, otherwise you FAE select will select the whole table, which will be much slower.&lt;/P&gt;&lt;P&gt;+ sort the result table after the select, and use read binary search inside the loop. If you use standard reads, your performance will again be slower than before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the SQL trace and the STAD again after the change and check how much your program did improve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 10:22:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888298#M934033</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T10:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888299#M934034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This varies from situation to situation. But to avoid select inside loop, you normally have two options.&lt;/P&gt;&lt;P&gt;1 - Use FOR ALL ENTRIES statement&lt;/P&gt;&lt;P&gt;2 - If it's possible, make only one bigger and insert into an internal table, and then, when looping you r table, read the second table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Valter Oliveira.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 12:06:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888299#M934034</guid>
      <dc:creator>valter_oliveira</dc:creator>
      <dc:date>2008-06-04T12:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888300#M934035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If u are looping at internal table say &lt;STRONG&gt;itab&lt;/STRONG&gt; and using select inside loop,then use :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &amp;lt;fiellds u want to select&amp;gt;&lt;/P&gt;&lt;P&gt; from &amp;lt;table name&amp;gt;&lt;/P&gt;&lt;P&gt; into table&amp;lt;internal table having fields u want to select&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;for all entreis in itab&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;where &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this code .&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;Mukul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2008 09:05:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3888300#M934035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-05T09:05:25Z</dc:date>
    </item>
  </channel>
</rss>

