<?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: Code  taking too much time to output in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836149#M1472375</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sir, I tried your idea like &lt;/P&gt;&lt;P&gt;LOOP AT itab.&lt;/P&gt;&lt;P&gt;    ind = sy-tabix.&lt;/P&gt;&lt;P&gt;    SELECT SINGLE * FROM mseg INTO mseg&lt;/P&gt;&lt;P&gt;WHERE bwart = '102'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at mseg .&lt;/P&gt;&lt;P&gt;read table itab with key bwart = '102'&lt;/P&gt;&lt;P&gt;                         mblnr = mseg-lfbnr&lt;/P&gt;&lt;P&gt;                         ebeln = mseg-ebeln&lt;/P&gt;&lt;P&gt;                        ebelp = mseg-ebelp binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;      DELETE itab INDEX ind.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;It increase the performance but it is not deleting itab for condition bwart 102. Please do check me , what m doing wrong ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Apr 2010 11:52:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-05T11:52:46Z</dc:date>
    <item>
      <title>Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836139#M1472365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Following  code is taking too much time to execute . (some time giving Time_out )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ind = sy-tabix.&lt;/P&gt;&lt;P&gt;    SELECT SINGLE * FROM mseg INTO mseg&lt;/P&gt;&lt;P&gt;       WHERE bwart = '102' AND&lt;/P&gt;&lt;P&gt;             lfbnr = itab-mblnr AND&lt;/P&gt;&lt;P&gt;             ebeln = itab-ebeln AND&lt;/P&gt;&lt;P&gt;             ebelp = itab-ebelp.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      DELETE itab INDEX ind.&lt;/P&gt;&lt;P&gt;      CONTINUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any other way to write this code to reduce the output time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 06:52:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836139#M1472365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T06:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836140#M1472366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why dont you select all the data from MSEG once??? Outside the loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM mseg INTO mseg&lt;/P&gt;&lt;P&gt;WHERE bwart = '102'.&lt;/P&gt;&lt;P&gt;sort mseg.&lt;/P&gt;&lt;P&gt;Now Read table mseg where mseg = itab-mblnr AND&lt;/P&gt;&lt;P&gt;ebeln = itab-ebeln AND&lt;/P&gt;&lt;P&gt;ebelp = itab-ebelp  Binary Search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This might work in a lesser time&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 06:58:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836140#M1472366</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T06:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836141#M1472367</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;u can select what are all the field s u need to display in out put screen instead of taking all  fields from the MSEG,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(other wise try UPTO ONE ROW  statement .)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 07:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836141#M1472367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T07:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836142#M1472368</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;I think you are executing this code in a loop which is causing the problem. The rule is "Never put SELECT statements inside a loop".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to rewrite the code as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Outside the loop
SELECT *
from MSEG
into table lt_mseg
for all entries in itab
where bwart = '102' AND
lfbnr = itab-mblnr AND
ebeln = itab-ebeln AND
ebelp = itab-ebelp.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then inside the loop, do a READ on the internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Loop at itab.

*******

read table lt_mseg with key bwart = '102'. "plus other conditions
if sy-subrc ne 0.
delete itab. "index is automatically determined here from SY-TABIX
endif.

******

endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this should optimise performance. You can check your code's performance using SE30 or ST05.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps! Please revert if you need anything else!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Shailesh.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Always provide feedback for helpful answers!&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 07:12:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836142#M1472368</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T07:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836143#M1472369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   You can try with creating secondary index with the same combination .It will reduce your time.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ankita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 07:16:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836143#M1472369</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T07:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836144#M1472370</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;i think the problem is that you are extracting the data from the same place and replacing it in the same place in the table....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try putting the extracted data into an internal table first and then use the update statement to update the table with the given data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 07:18:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836144#M1472370</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T07:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836145#M1472371</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 SINGLE * FROM mseg INTO mseg
WHERE bwart = '102'.

loop at mseg into wa_mseg.
read table itab into wa_itab with key mblnr = wa_mseg-lfbnr
                                      ebeln = wa_mseg-ebeln
                                      ebelp = wa_mseg-ebelp.
if sy-subrc eq 0.
 ind = sy-tabix.
 DELETE itab INDEX ind.
endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 07:18:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836145#M1472371</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T07:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836146#M1472372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Within standard SAP there's no appropriate index on MSEG to support your query. Thus instead of selecting the material document directly from MSEG via the purchase order number, you should first get the material documents via the purchase order history table &lt;STRONG&gt;EKBE&lt;/STRONG&gt;. Then you can read the MSEG data you need using the material document number (mseg-mblnr=ekbe-belnr, mseg-mjahr=ekbe-gjahr, mseg-zeile=ekbe-buzei) or simply use a join on EKBE and MSEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should give you the speed you're looking for... &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, harald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 08:36:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836146#M1472372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T08:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836147#M1472373</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;Try this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sELECT SINGLE * FROM mseg INTO mseg&lt;/P&gt;&lt;P&gt;WHERE &lt;/P&gt;&lt;P&gt;lfbnr = itab-mblnr AND&lt;/P&gt;&lt;P&gt;ebeln = itab-ebeln AND&lt;/P&gt;&lt;P&gt;ebelp = itab-ebelp and&lt;/P&gt;&lt;P&gt;bwart = '102'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;DELETE itab INDEX ind.&lt;/P&gt;&lt;P&gt;CONTINUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may help out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 09:08:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836147#M1472373</guid>
      <dc:creator>sivaprasad_ml</dc:creator>
      <dc:date>2010-04-05T09:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836148#M1472374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I welcome Mr Harold's suggestion too. You can try with that too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 09:11:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836148#M1472374</guid>
      <dc:creator>sivaprasad_ml</dc:creator>
      <dc:date>2010-04-05T09:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836149#M1472375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi sir, I tried your idea like &lt;/P&gt;&lt;P&gt;LOOP AT itab.&lt;/P&gt;&lt;P&gt;    ind = sy-tabix.&lt;/P&gt;&lt;P&gt;    SELECT SINGLE * FROM mseg INTO mseg&lt;/P&gt;&lt;P&gt;WHERE bwart = '102'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at mseg .&lt;/P&gt;&lt;P&gt;read table itab with key bwart = '102'&lt;/P&gt;&lt;P&gt;                         mblnr = mseg-lfbnr&lt;/P&gt;&lt;P&gt;                         ebeln = mseg-ebeln&lt;/P&gt;&lt;P&gt;                        ebelp = mseg-ebelp binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;      DELETE itab INDEX ind.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;It increase the performance but it is not deleting itab for condition bwart 102. Please do check me , what m doing wrong ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 11:52:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836149#M1472375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T11:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Code  taking too much time to output</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836150#M1472376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;  Please do check me , what m doing wrong ?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Apr 2010 13:06:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-taking-too-much-time-to-output/m-p/6836150#M1472376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-05T13:06:18Z</dc:date>
    </item>
  </channel>
</rss>

