<?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: reduce execution time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155299#M993502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT aufnr bstmg hsdat sgtxt bwart charg 
    FROM mseg INTO CORRESPONDING FIELDS OF TABLE porder
  FOR ALL ENTRIES IN poder1
  WHERE matnr = porder1-matnr AND
        aufnr = porder1-aufnr AND
        werks = porder1-pwerk AND
        ( bwart = '101' OR
          bwart = '102' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jul 2008 10:28:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-22T10:28:04Z</dc:date>
    <item>
      <title>reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155297#M993500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to reduce the execution time of this code?  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at porder1.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt; SELECT aufnr bstmg hsdat sgtxt bwart charg FROM mseg INTO&lt;/P&gt;&lt;P&gt;(porder-aufnr,porder-bstmg,porder-hsdat,porder-sgtxt,porder-bwart,&lt;/P&gt;&lt;P&gt;porder-charg)&lt;/P&gt;&lt;P&gt;                                         WHERE matnr = porder1-matnr AND&lt;/P&gt;&lt;P&gt;                                               aufnr = porder1-aufnr AND&lt;/P&gt;&lt;P&gt;                                               werks = porder1-pwerk AND&lt;/P&gt;&lt;P&gt;                                               ( bwart = '101' OR&lt;/P&gt;&lt;P&gt;                                                 bwart = '102' ).&lt;/P&gt;&lt;P&gt;Endselect.&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;Regards&lt;/P&gt;&lt;P&gt;Praju .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:24:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155297#M993500</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155298#M993501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;instead of writing select..endselect inside loop..endloop&lt;/P&gt;&lt;P&gt;use for all entries ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:27:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155298#M993501</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155299#M993502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT aufnr bstmg hsdat sgtxt bwart charg 
    FROM mseg INTO CORRESPONDING FIELDS OF TABLE porder
  FOR ALL ENTRIES IN poder1
  WHERE matnr = porder1-matnr AND
        aufnr = porder1-aufnr AND
        werks = porder1-pwerk AND
        ( bwart = '101' OR
          bwart = '102' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Adil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:28:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155299#M993502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155300#M993503</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;Instead of fetching data using LOOP AT and SELECT ENDSELECT,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create one internal table and put whole Data in the table that will reduce your time of execution considerably.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without using SELECT and ENDSELECT.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sumit Agarwal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:28:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155300#M993503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155301#M993504</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;Instead of using the select stmt inside the loop, fetch all the required values from the MESG table for all entries in the porder1 into an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then read the internal table inside the loop.&lt;/P&gt;&lt;P&gt;This may reduce the execution time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;Sharin.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:29:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155301#M993504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155302#M993505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hiii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avoid using SELECT ENDSELECT here...instead of using this you can use simple SELECT statement and get all that data in one internal table and then use LOOP statement with conditions so that server will be hit only once and then you can use loop statement for any conditions and you can use READ statement also. this way performance will be incresed..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:30:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155302#M993505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155303#M993506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prajwal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at porder1.

SELECT aufnr bstmg hsdat sgtxt bwart charg FROM mseg INTO
(porder-aufnr,porder-bstmg,porder-hsdat,porder-sgtxt,porder-bwart,
porder-charg)
WHERE matnr = porder1-matnr AND
aufnr = porder1-aufnr AND
werks = porder1-pwerk AND
( bwart = '101' OR
bwart = '102' ).
+Endselect.+

Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes i know that you can't avoid select query inside the loop because its dynamic query but still you can avoid the select endselect.&lt;/P&gt;&lt;P&gt;Here use into table insted of  variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sandeep&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sandeep patel on Jul 22, 2008 4:00 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:30:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155303#M993506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155304#M993507</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 shouldn't write a select statement in loop....endloop.&lt;/P&gt;&lt;P&gt;Rather first select the porder data and do a 'FOR ALL ENTRIES' while selecting from MSEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your select statement should be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select data from table into porder1.

if not porder1[] is initial.
select data from mseg into porder
*for all entries* in porder1
where matnr = porder1-matnr AND
aufnr = porder1-aufnr AND
werks = porder1-pwerk AND
( bwart = '101' OR
bwart = '102' ).
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shailaja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:30:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155304#M993507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155305#M993508</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;It is not advisable to use select statement inside loop..&lt;/P&gt;&lt;P&gt;Instead select entries outside loop and sort.&lt;/P&gt;&lt;P&gt;And inside loop use Read statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sachin M M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:31:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155305#M993508</guid>
      <dc:creator>sachin_mathapati</dc:creator>
      <dc:date>2008-07-22T10:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155306#M993509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prajwal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT-ENDSELECT is a looping statement which selects every single record based on the condition. This raises a performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead you can use SELECT statement with Internal Table, as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT aufnr bstmg hsdat sgtxt bwart charg 
FROM mseg 
INTO &amp;lt; itab &amp;gt;
WHERE matnr = porder1-matnr AND
aufnr = porder1-aufnr AND
werks = porder1-pwerk AND
( bwart = '101' OR
bwart = '102' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, the internal table is of the structure of the selected fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandra Sekhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155306#M993509</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155307#M993510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi prajwal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to suggest,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is possible to reduce the time of execution by Increasing the number of fields in the WHERE clause as only those specific number of records are fetched which results in comparatively less execution time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, SAP has designed such powerfull tools like Transactions - ST05,  ST07, ST30, and many more &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to suggest you a couple of references relating to your case,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN - Reference for Long execution time during processing of a select query|/thread/477540 &lt;B&gt;[original link is broken]&lt;/B&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN - Reference for Reducing the Execution time of the program - Tools|&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="317276"&gt;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[SDN - Reference for solutions to reduce the execution time of a program|&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="458499"&gt;&lt;/A&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that's usefull.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck &amp;amp; Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Harsh Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:36:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155307#M993510</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155308#M993511</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;try with this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not tb_porder1[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select f1 &lt;/P&gt;&lt;P&gt;          f2&lt;/P&gt;&lt;P&gt;          fn&lt;/P&gt;&lt;P&gt;into tb_porder&lt;/P&gt;&lt;P&gt;from mseg&lt;/P&gt;&lt;P&gt;for all entries in tb_porder1&lt;/P&gt;&lt;P&gt;where matnr = tb_porder1-matnr&lt;/P&gt;&lt;P&gt;(rest of the clause.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;*error&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&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 possible try to use loop at internal table into workarea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then read statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:37:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155308#M993511</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: reduce execution time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155309#M993512</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;  first of all to reduce execution time first f all aoid select end select.Instead use correspinding fields of table.that will save a lot of time.&lt;/P&gt;&lt;P&gt;this will all the entires at a time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 10:39:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reduce-execution-time/m-p/4155309#M993512</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T10:39:39Z</dc:date>
    </item>
  </channel>
</rss>

