<?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 inside a  Loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608735#M1438524</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I discuss this point extensively ... in a German test book&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.dpunkt.de/buch/3096.html" target="test_blank"&gt;http://www.dpunkt.de/buch/3096.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are three possiblities for nested processing of internal tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab1
   read table itab2
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1:1 relation between records of the 2 tables. You must take care that the inner processing is faster than a sequential read,&lt;/P&gt;&lt;P&gt;i.e. use binary search (automatically with sorted tables) or direct access (index or hashed tables).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab1
   loop at itab2  where

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;1:C relation like header and position etc. This also automatically solved with sorted and hashed tables. With standard tables there is a bit more complicated work-around possible (see 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;PRE&gt;&lt;CODE&gt;
loop at itab1
   loop at itab2 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;No relation between the records of the two tables.&lt;/P&gt;&lt;P&gt;+ Either one of the two tables is small, then there is no problem.&lt;/P&gt;&lt;P&gt;+ Or there is relation where each record of the inner table is related to each record of the other, this is only the case with&lt;/P&gt;&lt;P&gt;complicated optimization problems, and usually never with business tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nested loops can alsop be constructed with READs and some logic on the indexes, can be nested over several modularization layer etc etc. They can look very different, but they are all the same!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course the same hold for MODIFY, INSERT and DELETE. The whole discussion needs 20 pages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I personally do not recommend the &lt;STRONG&gt;parallel cursor&lt;/STRONG&gt;, because it is much to complicated in the general case (both tables have extra records!&lt;IMG src=") and it requires that both tables must be sorted in the same way. If this is taken into account, then it does not make sense, maybe in very very very large tables.

USE sorted tables with useful keys and you can forget the whole discussion" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Feb 2010 11:51:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-15T11:51:57Z</dc:date>
    <item>
      <title>Loop inside a  Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608733#M1438522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wat  could  be the Best way of resolving  a  Loop  inside a  loop???? &lt;/P&gt;&lt;P&gt;wat are the possible ways of  resolving it..??? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advnce.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Aslam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2010 10:39:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608733#M1438522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-15T10:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a  Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608734#M1438523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use Parallel Cursors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;link:[http://help-abap.blogspot.com/2009/12/parallel-cursor-to-speed-up-performance.html]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2010 10:49:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608734#M1438523</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-02-15T10:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a  Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608735#M1438524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I discuss this point extensively ... in a German test book&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.dpunkt.de/buch/3096.html" target="test_blank"&gt;http://www.dpunkt.de/buch/3096.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are three possiblities for nested processing of internal tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab1
   read table itab2
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1:1 relation between records of the 2 tables. You must take care that the inner processing is faster than a sequential read,&lt;/P&gt;&lt;P&gt;i.e. use binary search (automatically with sorted tables) or direct access (index or hashed tables).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab1
   loop at itab2  where

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;1:C relation like header and position etc. This also automatically solved with sorted and hashed tables. With standard tables there is a bit more complicated work-around possible (see 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;PRE&gt;&lt;CODE&gt;
loop at itab1
   loop at itab2 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;No relation between the records of the two tables.&lt;/P&gt;&lt;P&gt;+ Either one of the two tables is small, then there is no problem.&lt;/P&gt;&lt;P&gt;+ Or there is relation where each record of the inner table is related to each record of the other, this is only the case with&lt;/P&gt;&lt;P&gt;complicated optimization problems, and usually never with business tasks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nested loops can alsop be constructed with READs and some logic on the indexes, can be nested over several modularization layer etc etc. They can look very different, but they are all the same!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course the same hold for MODIFY, INSERT and DELETE. The whole discussion needs 20 pages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I personally do not recommend the &lt;STRONG&gt;parallel cursor&lt;/STRONG&gt;, because it is much to complicated in the general case (both tables have extra records!&lt;IMG src=") and it requires that both tables must be sorted in the same way. If this is taken into account, then it does not make sense, maybe in very very very large tables.

USE sorted tables with useful keys and you can forget the whole discussion" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Feb 2010 11:51:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608735#M1438524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-15T11:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Loop inside a  Loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608736#M1438525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - Please search before asking - post locked&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2010 14:22:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-inside-a-loop/m-p/6608736#M1438525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-16T14:22:45Z</dc:date>
    </item>
  </channel>
</rss>

