<?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: Loop - Endloop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771002#M1118229</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guess ur having 100 records in itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First u have looped 100 times and done some anomalies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again u loop 100 times and do some changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the Loop count is 200 times for two operations..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead do it in a single loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Got it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance is better than readability &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 Nov 2008 04:51:46 GMT</pubDate>
    <dc:creator>kesavadas_thekkillath</dc:creator>
    <dc:date>2008-11-01T04:51:46Z</dc:date>
    <item>
      <title>Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771000#M1118227</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;will there be vast difference in execution time in the following two codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)   loop at itab into work area.&lt;/P&gt;&lt;P&gt;       .&lt;/P&gt;&lt;P&gt;       .some calculation with workarea&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;modify itab from workarea&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     loop at itab into workarea.&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;     read table from it_kna1 into wa_kna1.&lt;/P&gt;&lt;P&gt;     some assignmtn into workarea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;modify itab from workarea&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) &lt;/P&gt;&lt;P&gt;      loop at itab into work area.&lt;/P&gt;&lt;P&gt;      .  read table from it_kna1 into wa_kna1.&lt;/P&gt;&lt;P&gt;         some assignmtn into workarea.&lt;/P&gt;&lt;P&gt;        .some calculation with workarea&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;modify itab from workarea&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie. i need to modify the values in my itab following differnrnt conditions like either calculations or updationg the address fieldor so.. If I can place all the different modifications on itab in different loops, the code will be more clear.. But will that affect my performance?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 02:35:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771000#M1118227</guid>
      <dc:creator>lijisusan_mathews</dc:creator>
      <dc:date>2008-11-01T02:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771001#M1118228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;2) loop at itab into work area.&lt;/P&gt;&lt;P&gt;. read table from it_kna1 into wa_kna1.&lt;/P&gt;&lt;P&gt;some assignmtn into workarea.&lt;/P&gt;&lt;P&gt;.some calculation with workarea&lt;/P&gt;&lt;P&gt;modify itab from workarea&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this code will be good in performance wise.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try to avoid multiple loop..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 03:14:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771001#M1118228</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-01T03:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771002#M1118229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guess ur having 100 records in itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First u have looped 100 times and done some anomalies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again u loop 100 times and do some changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the Loop count is 200 times for two operations..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead do it in a single loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Got it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance is better than readability &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 04:51:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771002#M1118229</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-11-01T04:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771003#M1118230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;/P&gt;&lt;P&gt;  The second loop options that you ve given is best inregard from the point of performance basis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;loop at itab into work area.&lt;/P&gt;&lt;P&gt;. read table from it_kna1 into wa_kna1.&lt;/P&gt;&lt;P&gt;some assignmtn into workarea.&lt;/P&gt;&lt;P&gt;.some calculation with workarea&lt;/P&gt;&lt;P&gt;modify itab from workarea&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will loop the internal table as many times as the record present in the internal table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 08:35:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771003#M1118230</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-01T08:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771004#M1118231</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; Performance is better than readability &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not always.  In fact, often it isn't.  With most programs that you're likely to encounter, performance won't really be an issue. While we should endeavour to write programs that perform well, readability is very important as well.  The reason is: a readable program is easier to fix/maintain/enhance, and therefore &lt;STRONG&gt;cheaper&lt;/STRONG&gt; - most of the TCO of a development is not in the original development, but in the subsequent support.  Emphasising performance at the expense of readability should only be when performance is &lt;STRONG&gt;critical&lt;/STRONG&gt;.  I.e. there is a business requirement for the program to run faster.  So, if a program runs every night and takes 10 minutes, and will never take more than that, who cares if you can get the run time down to 9 minutes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, in the supplied example, 2) is the correct approach.  To keep readability, simply put the actions into some forms.  Also, in this occasion, depending on the quantity of data, use LOOP AT ASSIGNING, and remove the MODIFY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab assigning &amp;lt;fs&amp;gt;.
  perform do_stuff using it_kna1 changing &amp;lt;fs&amp;gt;.
  perform do_other_stuff changing &amp;lt;fs&amp;gt;.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 14:45:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771004#M1118231</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-11-01T14:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771005#M1118232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While the second option is slightly better, a much greater improvement will be gained by changing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table from it_kna1 into wa_kna1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table from it_kna1 into wa_kna1 &lt;STRONG&gt;binary search&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(You will have to sort before reading).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 18:26:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771005#M1118232</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-01T18:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771006#M1118233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or even better, using a HASHED table with a unique key.  ( If there isn't a unique key, use a SORTED table ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 22:05:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771006#M1118233</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-11-01T22:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771007#M1118234</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 your Logic for the Modification's is really complex and you feel that the report will be heavily used and hence modified..better go for the first option......Any program should be made with an approach that its going to be worked upon by n number of programmers in future and if your Logic is difficult to understand by your sucessive programmers that the cost of modifying &amp;amp; Maintaining the report will always be more than the required and hence an indirect cost to your Client.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the above can never be used as a thumb rule...it all actually depends on the situtaion...like the number of records your internal table will have at the runtime, because with fewer number of records expected at the run time ..you can easily go with the second option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So try to make a perfect and situtaion based balance between the performance and readibility/Simplicity of your code......taking into consideration that both are equally important......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Nov 2008 17:20:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771007#M1118234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-02T17:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Loop - Endloop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771008#M1118235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanx all.. I had to do some complex operations  and a lot of read statements from several tables to insert the values into a single table in the first loop.. actually i have to set the running number based on a few criteria for each of the record. So i was thinking of modifying that value separately (along with provingthe address details)in another loop depending on the criteria..This can be achieved in a single loop too, but it will reduce teh clarity of the program and it is a critical report.. But I guess using the Perform and read using binary search can be used to solve my  clarity and  performance issue..Thanx a lot all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suzie on Nov 3, 2008 5:10 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2008 16:09:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/4771008#M1118235</guid>
      <dc:creator>lijisusan_mathews</dc:creator>
      <dc:date>2008-11-03T16:09:25Z</dc:date>
    </item>
  </channel>
</rss>

