<?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 with in loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436631#M825296</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot for ur reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Feb 2008 07:16:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-19T07:16:32Z</dc:date>
    <item>
      <title>loop with in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436628#M825293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi experts,&lt;/P&gt;&lt;P&gt;can any body tell me how can a loop with in loop effect the performance of the abap program.&lt;/P&gt;&lt;P&gt;can we use like that .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 06:59:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436628#M825293</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-19T06:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: loop with in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436629#M825294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Usually "loop in loop" looks like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT header_itab.
  LOOP AT item_itab WHERE num = header_itab-num.
  ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;With standard (eg index) tables the item_tab can be fully read to select records at each pass. Only way to optimize is to have declared this table as a SORTED TABLE with the header number as a key. In this case the internal loop is optimized. - This is written in online abap documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 07:07:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436629#M825294</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2008-02-19T07:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: loop with in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436630#M825295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;loop at itab1. ( n records)&lt;/P&gt;&lt;P&gt;        loop at itab2. (m records)&lt;/P&gt;&lt;P&gt;        endloop.&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;for each record of itab1. entire itab2 is looping so finally inner loop is going to run n * m times.&lt;/P&gt;&lt;P&gt;so it is very poor performance&lt;/P&gt;&lt;P&gt;to avoid this u need to use read statement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 07:08:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436630#M825295</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-19T07:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: loop with in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436631#M825296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot for ur reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 07:16:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436631#M825296</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-19T07:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: loop with in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436632#M825297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks  a lot for ur reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 07:17:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436632#M825297</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-19T07:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: loop with in loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436633#M825298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the question is already answered then you forgot to give points!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is general assumption that you have either&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.   ( n records)&lt;/P&gt;&lt;P&gt;  loop at itab2.   ( a records, a constant)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1&lt;/P&gt;&lt;P&gt;  loop at itab2   where  key =   (m records in itab2, where m grows if n grows)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the first case you have no performance problem, it scales with n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the second case, you have a performance problem if itab2 is standard table. But you can avoid it, if you use sorted tables.&lt;/P&gt;&lt;P&gt;You can also avoid it for standard tables by a workaround&lt;/P&gt;&lt;P&gt;read binary search, loop from index, exit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For details on the workaround see&lt;/P&gt;&lt;P&gt;Measurements on internal tables: Reads and Loops:&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For background information on nonlinearity see&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/02/12/performance-problems-caused-by-nonlinear-coding&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2008 09:02:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-with-in-loop/m-p/3436633#M825298</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-19T09:02:59Z</dc:date>
    </item>
  </channel>
</rss>

