<?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: performance issue - with loops in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589609#M265505</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no it did not improve performance any way &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls ans 2nd question too plez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Sep 2006 07:46:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-11T07:46:13Z</dc:date>
    <item>
      <title>performance issue - with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589606#M265502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the best way to fix this loop performance wise?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   loop at i_vbak.&lt;/P&gt;&lt;P&gt;    loop at i_vbap where vbeln = i_vbak-vbeln.&lt;/P&gt;&lt;P&gt;      loop at i_vbep where vbeln = i_vbep-vbeln.&lt;/P&gt;&lt;P&gt;      xxxxxxxx&lt;/P&gt;&lt;P&gt;      xxxxxxxx&lt;/P&gt;&lt;P&gt;      endloop.&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;and also .... do you see any errors/performance issues with these statements. Please donot take "select" query in to consideration. of course "sort i_vbak" is one that needs to be considered i guess&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select * into i_vbak.  &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  read table i_vbak where vbeln = 'xxx'&lt;/P&gt;&lt;P&gt;                          posnr = 'yyy'&lt;/P&gt;&lt;P&gt;                          vkorg = 'zzz'&lt;/P&gt;&lt;P&gt;                          binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Thanks in advance. Enjoy! your weekends.&lt;/P&gt;&lt;P&gt;   Mary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Sep 2006 13:06:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589606#M265502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-10T13:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue - with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589607#M265503</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;It depends on number of hits inserted in the internal table. U can try to improve the performance using SORTED TABLE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: I_VBAP TYPE SORTED TABLE OF VBAP WITH NON-UNIQUE KEY VBELN WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;I_VBEP TYPE SORTED TABLE OF VBEP WITH NON-UNIQUE KEY VBELN WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_vbak.&lt;/P&gt;&lt;P&gt;loop at i_vbap where vbeln = i_vbak-vbeln.&lt;/P&gt;&lt;P&gt;loop at i_vbep where vbeln = i_vbep-vbeln.&lt;/P&gt;&lt;P&gt;xxxxxxxx&lt;/P&gt;&lt;P&gt;xxxxxxxx&lt;/P&gt;&lt;P&gt;endloop.&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;- U have to sort your table before using BINARY SEARCH options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT TABLE BY VBELN VKORG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE VBAK WITH KEY VBELN = ...&lt;/P&gt;&lt;P&gt;                         VKORG = .... binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Sep 2006 13:25:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589607#M265503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-10T13:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue - with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589608#M265504</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;   use below logic to increse performance&lt;/P&gt;&lt;P&gt;    sort i_vbak by vbeln.&lt;/P&gt;&lt;P&gt;    sort i_vbap by vbeln posnr.&lt;/P&gt;&lt;P&gt;    sort i_vbep by vbeln posnr .&lt;/P&gt;&lt;P&gt;data lv_index like sy-tabix.&lt;/P&gt;&lt;P&gt;     lv_index1 like sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at i_vbak.&lt;/P&gt;&lt;P&gt;  clear lv_index,lv_index1.&lt;/P&gt;&lt;P&gt; read table i_vbap with key vbeln = i_vbak-vbeln &lt;/P&gt;&lt;P&gt; binary   search.&lt;/P&gt;&lt;P&gt; if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;  lv_index = sy-tabix.&lt;/P&gt;&lt;P&gt;  loop at i_vbap from lv-index.&lt;/P&gt;&lt;P&gt;   if i_vbap-vbeln &amp;lt;&amp;gt; i_vbak-vbeln.&lt;/P&gt;&lt;P&gt;     exit.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt; read table i_vbep with key vbeln = i_vbap-vbeln &lt;/P&gt;&lt;P&gt;                            posnr = i_vbap-posnr &lt;/P&gt;&lt;P&gt;                            binary search.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;  if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;    lv_index1 = sy-tabix.&lt;/P&gt;&lt;P&gt;   loop at i_vbep from lv-index1.&lt;/P&gt;&lt;P&gt;   if i_vbep-vbeln &amp;lt;&amp;gt; i_vbak-vbeln.&lt;/P&gt;&lt;P&gt;     exit.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;P&gt; endif.&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;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Sep 2006 13:40:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589608#M265504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-10T13:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue - with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589609#M265505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no it did not improve performance any way &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls ans 2nd question too plez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2006 07:46:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589609#M265505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-11T07:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue - with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589610#M265506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select * into i_vbak. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select only  those field  which are  required.&lt;/P&gt;&lt;P&gt;and  use into table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select field1 field2  into table i_vbak from vbak where cond.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;sort i_vbak .&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;read table i_vbak &amp;lt;b&amp;gt;with key&amp;lt;/b&amp;gt; vbeln = 'xxx'&lt;/P&gt;&lt;P&gt;posnr = 'yyy'&lt;/P&gt;&lt;P&gt;vkorg = 'zzz'&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;don't  use nested  loop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;it  is  better u  1st take  join b/w vbak and vbap.&lt;/P&gt;&lt;P&gt;loop at i_vbak.&lt;/P&gt;&lt;P&gt;loop at i_vbap where vbeln = i_vbak-vbeln.&lt;/P&gt;&lt;P&gt;loop at i_vbep where vbeln = i_vbep-vbeln.&lt;/P&gt;&lt;P&gt;xxxxxxxx&lt;/P&gt;&lt;P&gt;xxxxxxxx&lt;/P&gt;&lt;P&gt;endloop.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2006 07:55:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589610#M265506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-11T07:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue - with loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589611#M265507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First of all nested loop is not good..we should always try and avoid it. As for your required since you dont want to use SELECT..is to surely sort the internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_vbak.&lt;/P&gt;&lt;P&gt;sort i_vbap.&lt;/P&gt;&lt;P&gt;sort i_vbep.&lt;/P&gt;&lt;P&gt;loop at i_vbak.&lt;/P&gt;&lt;P&gt;  clear i_vbap.&lt;/P&gt;&lt;P&gt;  loop at i_vbap where vbeln = i_vbak-vbeln.&lt;/P&gt;&lt;P&gt;    clear i_vbep.&lt;/P&gt;&lt;P&gt;    read table i_vbep with key vbeln = i_vbap-vbeln&lt;/P&gt;&lt;P&gt;                           and posnr = i_vbap-posnr.&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    endif.&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;--Try the above logic..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2006 08:16:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-loops/m-p/1589611#M265507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-11T08:16:34Z</dc:date>
    </item>
  </channel>
</rss>

