<?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: strange performance problem with parallel loops in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449012#M548747</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm I will look into it tomorrow . Is there a easy way to determine which loop causes the problem without having to make 2 forms out of it ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Jun 2007 14:30:24 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-20T14:30:24Z</dc:date>
    <item>
      <title>strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449007#M548742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have implemented parallel loops to increase my performance and it's working fine. however I have to do some additional acctions to prepare the code since the loop crashes when the key in the second table does not exist in the first table from the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my performance has increased dramaticaly when I looped through 40.000 x 10.000 records. but when I wanted to improve all the selections even more I also made a selection on the second loop which contains ordernumbers so only open orders would be in the table and not closed orders. so the amount is 40.000 x 3.000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but now the performance dropped even below the times with the old fashioned way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can somebody explain which caused this drop in performance ?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 it_prpsaufnrs[] = it_prpsrapp[].
    sort it_prpsaufnrs by aufnr.
    DELETE ADJACENT DUPLICATES FROM it_prpsaufnrs
    COMPARING aufnr .

  SORT it_prpsaufnrs BY aufnr.
  SORT it_catsdbtot BY raufnr.

  catstot_index = 1.
  prpsrapp_index = 1.
*remove ordernummers which are not in it_prpsrapp 
  LOOP AT it_catsdbtot INTO wa_catsdbtot.
    LOOP AT it_prpsaufnrs INTO wa_prpsaufnrs FROM prpsrapp_index.
      IF wa_prpsaufnrs-aufnr = wa_catsdbtot-raufnr.
        prpsrapp_index = sy-tabix.
        h_exist = 'X'.
        EXIT.
      ELSE.
        h_exist = ''.
      ENDIF.

    ENDLOOP.

    IF h_exist = 'X'.
      APPEND wa_catsdbtot TO it_catsdbtot2.
    ENDIF.
  ENDLOOP.

  SORT it_prpsrapp BY pernr_cats aufpl aplzl.
  SORT it_catsdbtot2 BY pernr raufpl raplzl.

  LOOP AT it_prpsrapp.
    it_prpsrapp-totaal = 0.
*ads 19-07-2006 nieuwe poging performance verbetering parralel_cursor
    LOOP AT it_catsdbtot2 INTO wa_catsdbtot FROM catstot_index.
      IF wa_catsdbtot-pernr &amp;lt;&amp;gt; it_prpsrapp-pernr_cats
         OR wa_catsdbtot-raufpl &amp;lt;&amp;gt; it_prpsrapp-aufpl
         OR wa_catsdbtot-raplzl &amp;lt;&amp;gt; it_prpsrapp-aplzl.
        catstot_index = sy-tabix.
        EXIT.
      ELSE.
        it_prpsrapp-totaal = it_prpsrapp-totaal + wa_catsdbtot-catshours.

      ENDIF.

    ENDLOOP.
    MODIFY it_prpsrapp.
 ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or if somebody has a good idea to make the parralel loop more monkey proof so it won't crash when the second table contains keys which the main table doesn't have . that would also be nice &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kind regards &lt;/P&gt;&lt;P&gt;arthur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        A. de Smidt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:48:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449007#M548742</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449008#M548743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You still have nested loops. Check:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:57:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449008#M548743</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449009#M548744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Rob as you can see I use the same code as mentioned in the Log you mentioned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but why is 40.000 x 10.000  30 times faster than 40.000 x 3.000 in the above code ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 14:18:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449009#M548744</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T14:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449010#M548745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now that I've looked at it a bit more, that may not be the problem. I'll look at it again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 14:19:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449010#M548745</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T14:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449011#M548746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the problem with the first loop where you remove the lines or the second one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 14:21:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449011#M548746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T14:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449012#M548747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmm I will look into it tomorrow . Is there a easy way to determine which loop causes the problem without having to make 2 forms out of it ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 14:30:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449012#M548747</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T14:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449013#M548748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I found it. Try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

catstot_index = 1.
prpsrapp_index = 1.
*remove ordernummers which are not in it_prpsrapp
LOOP AT it_catsdbtot INTO wa_catsdbtot.
  LOOP AT it_prpsaufnrs INTO wa_prpsaufnrs FROM prpsrapp_index.
    CLEAR h_exist.
    IF wa_prpsaufnrs-aufnr = wa_catsdbtot-raufnr.
      prpsrapp_index = sy-tabix.
      h_exist = 'X'.
    ENDIF.
    EXIT.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 14:34:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449013#M548748</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T14:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449014#M548749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A cleaner and easier to read way would be:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*remove ordernummers which are not in it_prpsrapp
LOOP AT it_catsdbtot INTO wa_catsdbtot.
  READ TABLE it_prpsaufnrs INTO wa_prpsaufnrs
    WITH KEY aufnr = it_catsdbtot-raufnr
    BINARY SEARCH.
  IF sy-subrc = 0.
    APPEND wa_catsdbtot TO it_catsdbtot2
    endif.
  ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't tested either of these, but the problem seems to be that your original loop kept going after finding a hit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 14:44:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449014#M548749</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T14:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449015#M548750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep I also got the feeling that something was wrong in the loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is working fantastic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps if you ever find a nice sollution for the problem of additional keys in the table inside the loop it would be nice to hear &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't check the index procedure for doing nested loops but has it the same problem ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 14:33:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449015#M548750</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T14:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: strange performance problem with parallel loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449016#M548751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the parallel cursor methd to loop through both tables simultaneously. The coding is kind of tricky though. You have to keep track of two sets of keys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 16:02:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/strange-performance-problem-with-parallel-loops/m-p/2449016#M548751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T16:02:55Z</dc:date>
    </item>
  </channel>
</rss>

