<?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 in LOOP, (self loop) performance tuning ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143186#M1906319</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was surprised because &lt;A __default_attr="4662" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Siegfried Boes" href="https://community.sap.com/"&gt;&lt;/A&gt; says in this thread &lt;A __default_attr="1372646" __jive_macro_name="thread" class="jive_macro_thread jive_macro" data-orig-content="The parallel index / cursor and whatsoever solutions" href="https://community.sap.com/"&gt;&lt;/A&gt; that he's not convinced with the parallel cursor technique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hardly work with STANDARD tables since a few years, for me it's either HASHED or SORTED table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had asked you the question because i don't have the concrete answer to my question - "Are HASHED tables better than SORTED table?"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes HASHED tables are a pain. For e.g., when accessing the first/last records, deleting the content of the table inside the LOOP. Both of them arise due to the fact that index access is not possible with HASHED tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jul 2015 13:35:11 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2015-07-20T13:35:11Z</dc:date>
    <item>
      <title>LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143180#M1906313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAP folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please advise on the below code. My transformation program is taking 55 minutes to complete 1 round for 100,000 records....which is very bad coding. I am not good in abap. Can you please help me to fine tune the below code for optimum performance. &lt;SPAN style="text-decoration: underline;"&gt;I know its difficult to understand other's code without the actual scenario&lt;/SPAN&gt; . But at-least at a high level any suggestion's like using field symbol's or sort or binary search any key words is much appreciated. I will be great at-least if it comes down 15 minutes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need more details, I can update you. Basically this is written in the end-routine of the DSO. to get the &lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #ff0000; text-decoration: underline;"&gt;add quanity and sub quantity of the material's based on the material movements&lt;/SPAN&gt;&lt;/SPAN&gt; and to get the &lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #575757; text-decoration: underline;"&gt;&lt;SPAN style="color: #ff0000; text-decoration: underline;"&gt;price of the material's&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; in the 2nd block based on the PO amount and Material amount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOOP AT RESULT_PACKAGE ASSIGNING &amp;lt;fs_rp&amp;gt;.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLEAR: subqty, addqty, wa_ITAB1, WA_ITAB2, WA_ITAB3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOOP AT it_ITAB1 INTO wa_ITAB1 WHERE PLANT =&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-PLANT&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND MATERIAL = &amp;lt;fs_rp&amp;gt;-MATERIAL&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND PSTNG_DATE = &amp;lt;fs_rp&amp;gt;-DATE0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF wa_ITAB1-MOVETYPE EQ '312'.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; addqty = addqty + wa_ITAB1-QUANT_B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF wa_ITAB1-MOVETYPE EQ '202'.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subqty = subqty + wa_ITAB1-QUANT_B.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-/BIC/YIO_ADD = addqty.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-/BIC/YIO_SUB = subqty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;*Calculating material price in the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF &amp;lt;fs_rp&amp;gt;-/BIC/YIOFLAG EQ 'Y'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; READ TABLE it_ITAB2 INTO WA_ITAB2 WITH KEY MATERIAL =&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-MATERIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SY-SUBRC = 0.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;lt;FS_RP&amp;gt;-/BIC/YIOQNTPR = WA_ITAB2-NETPRICE.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;lt;FS_RP&amp;gt;-LOC_CURRCY = WA_ITAB2-LOC_CURRCY.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF &amp;lt;fs_rp&amp;gt;-/BIC/YIOFLAG&amp;nbsp; EQ 'N'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; READ TABLE IT_ITAB3 INTO WA_ITAB3 WITH key MATERIAL =&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FS_RP&amp;gt;-MATERIAL&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLANT =&amp;nbsp; &amp;lt;FS_RP&amp;gt;-PLANT&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALMONTH = &amp;lt;FS_RP&amp;gt;-CALMONTH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SY-SUBRC = 0.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;lt;FS_RP&amp;gt;-/BIC/YIOQNTPR = WA_ITAB3-PRICE_VAL.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;lt;FS_RP&amp;gt;-LOC_CURRCY = WA_ITAB3-CURRENCY.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDLOOP.&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;Thanks&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;DR&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Moderator message: Enough tips/hints have already been given. The OP must use them to re-write the code. Spoonfeeding shall not be allowed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Thread locked!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Suhas Saha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 12:15:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143180#M1906313</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T12:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143181#M1906314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use Parallel cursror on the LOOP at &lt;SPAN style="color: #333333; font-size: 12px;"&gt; it_ITAB1( Check Tips and Tricks under transaction SAT )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From SAT Help&lt;/P&gt;&lt;P&gt;&lt;SPAN class="HEADING"&gt;Documentation&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If ITAB1 has n1 entries and ITAB2 has n2 entries, the time needed for &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;the nested loop with the straightforward algorithm is O(n1 * n2), &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;whereas the parallel cursor approach takes only O(n1 + n2) time. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The above parallel cursor algorithm assumes that ITAB2 contains only &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;entries also contained in ITAB1. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this assumption does not hold, the parallel cursor algorithm &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;gets slightly more complicated, but its performance characteristics &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;remain the same.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also. ITAB2 and ITAB3 can be declared as HASHED(Preferred) / SORTED table(Or Read with BINARY SEARCH ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will surely have an impact on the performance improvement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 12:27:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143181#M1906314</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T12:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143182#M1906315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please do the following changes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Use parallel cursor method for nested loop concept &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;A href="http://wiki.scn.sap.com/wiki/display/Snippets/ABAP+Code+for+Parallel+Cursor+-+Loop+Processing" title="http://wiki.scn.sap.com/wiki/display/Snippets/ABAP+Code+for+Parallel+Cursor+-+Loop+Processing"&gt;ABAP Code for Parallel Cursor - Loop Processing - Code Gallery - SCN Wiki&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use Binary search in Read statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you can feel the difference in performance. &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;&lt;/P&gt;&lt;P&gt;Rajkumar Narasimman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 12:33:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143182#M1906315</guid>
      <dc:creator>rajkumarnarasimman</dc:creator>
      <dc:date>2015-07-20T12:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143183#M1906316</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;add some info about the amount of entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.As you already mentioned, work with sorted tables. give this sorted tables a key. use this key when&amp;nbsp; doing loop and read table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.use "assigning" instead of "into"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. reduce the amount of loops by writing if statements in the where clause. (if possible)&lt;/P&gt;&lt;P&gt;for example add key movetype to the typedefinition of sorted table it_ITAB1 and add in where condition where MOVETYPE eq 312 or 202.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Stefan Seeburger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 12:36:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143183#M1906316</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T12:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143184#M1906317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am surprised that SAP suggests "parallel cursor" approach in SAT &lt;SPAN __jive_emoticon_name="confused" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1322/images/emoticons/confused.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;ITAB2 and ITAB3 can be declared as &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;HASHED(Preferred)&lt;/STRONG&gt;&lt;/SPAN&gt; / &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;SORTED table(Or Read with BINARY SEARCH )&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;/P&gt;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Anyway, what do you mean by this? Why do you use "preferred" with HASHED table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LOOP...WHERE statement is optimised for -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;SORTED tables with full primary key/partial key(left-justified)&lt;/LI&gt;&lt;LI&gt;HASHED tables with full primary key&lt;/LI&gt;&lt;LI&gt;All table types with secondary key&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further info - &lt;A href="http://help.sap.com/abapdocu_731/en/abenitab_where_optimization.htm" title="http://help.sap.com/abapdocu_731/en/abenitab_where_optimization.htm"&gt;ABAP Keyword Documentation&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 12:40:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143184#M1906317</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2015-07-20T12:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143185#M1906318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually It does. In transaction SAT ( It used to be SE30 ). Under "Tip and Tricks" check the pic.I don't prefer to search over the internet when I get the necessary info inside the system itself. There can be many ways to consume information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the ITAB2 and ITAB3 are read with MATERIAL and I think can be converted to Hashed table as the data volume is high here and I am sure you know the benefit..Again SAT Tips and Tricks can be of help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By "Preferred" I meant Hashed table tend to give a better result when number of entries are around more than 1000 that SORTED Table(At least in my Programming experience of 14 years I have seen that). I think you will agree that it will at least be better than doing simple read.( If the entries are more than 20 : Again Ref : SAT Tips and ricks ) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/751737" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 12:52:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143185#M1906318</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T12:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143186#M1906319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was surprised because &lt;A __default_attr="4662" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Siegfried Boes" href="https://community.sap.com/"&gt;&lt;/A&gt; says in this thread &lt;A __default_attr="1372646" __jive_macro_name="thread" class="jive_macro_thread jive_macro" data-orig-content="The parallel index / cursor and whatsoever solutions" href="https://community.sap.com/"&gt;&lt;/A&gt; that he's not convinced with the parallel cursor technique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hardly work with STANDARD tables since a few years, for me it's either HASHED or SORTED table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had asked you the question because i don't have the concrete answer to my question - "Are HASHED tables better than SORTED table?"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sometimes HASHED tables are a pain. For e.g., when accessing the first/last records, deleting the content of the table inside the LOOP. Both of them arise due to the fact that index access is not possible with HASHED tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 13:35:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143186#M1906319</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2015-07-20T13:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143187#M1906320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah.. I see.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I have seen great improvements. One of my BOM&amp;nbsp; report was running for 40 hours :-). Using parallel cursor reduced it to 3 Hours &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_macro jive_emote" src="https://community.sap.com/1322/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per as the HASHED tables are concerned , yes they are of great help as long as we do any read operation with the same key as . the read time is constant for hashed tables and for large table with read I would always go for Hashed tables(If possible) instead of SORTED tables. Again I experienced the hugh benefit by myself in custom BW extractors and Reports.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with your second and fourth paragraph totally. Even I cannot remember when I have used standard tables ( Except Obviously SET_TABLE_FOR_FIRST_DISPLAY usage ) and yes hashed tables has got limitations &lt;SPAN style="font-size: 10pt;"&gt;but again ..&lt;/SPAN&gt;"Writing ABAP code is easy but writing good ABAP code is very difficult" &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 13:52:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143187#M1906320</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T13:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143188#M1906321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Except Obviously SET_TABLE_FOR_FIRST_DISPLAY usage&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or even BAPI tables ... In such cases i mostly use &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1322/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES OF sorted/hashed table TO alv_table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 14:25:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143188#M1906321</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2015-07-20T14:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143189#M1906322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BAPI or FM tables I agree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But what do you mean by "&lt;SPAN style="color: #333333; font-size: 12px;"&gt;APPEND LINES OF sorted/hashed table TO alv_table."?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 14:48:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143189#M1906322</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T14:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143190#M1906323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone for their replies. But let me tell you , I am not an abaper, but a sap bi consultant. appreciate if you can please fine tune the code with the given fields or table names and I would try to use your code with my minimum abap knowledge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the way, this transformation program runs daily for mat_plant MD which is around 100,000 records. Bascially the requirement is to read the stock count added/substrated by reading the material movement delta ( changed records) and will modify the added/substracted quantity for each of every material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example ...1st block is for the changed inventory values ..if plant a, material 1000 it will check the mat movements 312 and 202 and will modify add quantity or substracted quantity based on the material movement data. the reason we are comparing with posting date is to compare the current day's delta of the material movements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and 2nd block is to calculate the price of the material's .....if flag = y for material price from the PO's created for those material's and material standard price for the flag N material's. Bascially this will be done daily for all the 100,000 mat_plant master data. Just to calculate the price of the material. cost of each material to be precise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the overall logic. You all great experienced abaper's suggesting different techniques, to be frank. I cant try any of them. If you guys provide me the modified code atleast at high level, I will try to decode it with my abap team else I will try to figure it my self with my research. I cannot just change the code if you say, just try it with parallel cursor's &lt;SPAN __jive_emoticon_name="laugh" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1322/images/emoticons/laugh.gif"&gt;&lt;/SPAN&gt; or use hashed tables etc...as I dont even have a clue .how to change it &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/1322/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt;. I am sorry, but helpless. Hope you understand the progam and my situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please update if you need more details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;N&lt;SPAN style="color: #ff0000; text-decoration: underline;"&gt;OTE : Result package will have the total mat_plant md . Just the material's with respect to their plants along with today's date, as I said its a daily full load from ECC. Hope this helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 16:09:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143190#M1906323</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T16:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143191#M1906324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you please retune the code with the suggested approach of parallel cursor and binary search . Thanks for your advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 17:03:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143191#M1906324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T17:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143192#M1906325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear raj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the reply. Can you please change/update the code with parallel cursor and binary search with read. I will do the syntax modifications. Please provide the high level code atleast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;DR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2015 17:05:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143192#M1906325</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-20T17:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143193#M1906326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you please change my code with paraller cursor's so that I can use it to reduce the run time. Atleast give me high level statements, I will try to convert with ABAP syntax using help. Appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;DR&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2015 03:26:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143193#M1906326</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-21T03:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143194#M1906327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use below code for the loop statement (Using Parallel Cursor) :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT : RESULT_PACKAGE BY &lt;SPAN style="color: #333333; font-size: 12px;"&gt;PLANT &lt;SPAN style="color: #333333; font-size: 12px;"&gt;MATERIAL &lt;SPAN style="color: #333333; font-size: 12px;"&gt;DATE0,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #333333; font-size: 12px;"&gt;it_ITAB1 BY &lt;SPAN style="color: #333333; font-size: 12px;"&gt;PLANT &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;MATERIAL &lt;SPAN style="color: #333333; font-size: 12px;"&gt;PSTNG_DATE.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : ld_index type SY-TABIX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;LOOP AT RESULT_PACKAGE ASSIGNING &amp;lt;fs_rp&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLEAR: subqty, addqty, wa_ITAB1, WA_ITAB2, WA_ITAB3.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; READ it_ITAB1 INTO wa_ITAB1 WHERE PLANT =&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-PLANT&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND MATERIAL = &amp;lt;fs_rp&amp;gt;-MATERIAL&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND PSTNG_DATE = &amp;lt;fs_rp&amp;gt;-DATE0 BINARY SEARCH.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SY-SUBRC = 0.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ld_index = sy-tabix.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOOP AT it_ITAB1 INTO wa_ITAB1 FROM ld_index.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF PLANT &amp;lt;&amp;gt; &amp;lt;fs_rp&amp;gt;-PLANT AND MATERIAL &amp;lt;&amp;gt; &amp;lt;fs_rp&amp;gt;-MATERIAL &amp;lt;&amp;gt; PSTNG_DATE = &amp;lt;fs_rp&amp;gt;-DATE0.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXIT.&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF wa_ITAB1-MOVETYPE EQ '312'.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; addqty = addqty + wa_ITAB1-QUANT_B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF wa_ITAB1-MOVETYPE EQ '202'.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subqty = subqty + wa_ITAB1-QUANT_B.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDLOOP.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt; &amp;lt;fs_rp&amp;gt;-/BIC/YIO_ADD = addqty.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-/BIC/YIO_SUB = subqty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;*Calculating material price in the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF &amp;lt;fs_rp&amp;gt;-/BIC/YIOFLAG EQ 'Y'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; READ TABLE it_ITAB2 INTO WA_ITAB2 WITH KEY MATERIAL =&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-MATERIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SY-SUBRC = 0.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FS_RP&amp;gt;-/BIC/YIOQNTPR = WA_ITAB2-NETPRICE.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FS_RP&amp;gt;-LOC_CURRCY = WA_ITAB2-LOC_CURRCY.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF &amp;lt;fs_rp&amp;gt;-/BIC/YIOFLAG&amp;nbsp; EQ 'N'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; READ TABLE IT_ITAB3 INTO WA_ITAB3 WITH key MATERIAL =&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FS_RP&amp;gt;-MATERIAL&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLANT =&amp;nbsp; &amp;lt;FS_RP&amp;gt;-PLANT&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALMONTH = &amp;lt;FS_RP&amp;gt;-CALMONTH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SY-SUBRC = 0.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FS_RP&amp;gt;-/BIC/YIOQNTPR = WA_ITAB3-PRICE_VAL.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;FS_RP&amp;gt;-LOC_CURRCY = WA_ITAB3-CURRENCY.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDLOOP.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;Regards,&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;Hitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2015 04:07:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143194#M1906327</guid>
      <dc:creator>hitesh_gabani</dc:creator>
      <dc:date>2015-07-21T04:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143195#M1906328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Hitesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting the below error while doing the syntax check. Can you please advise where do I correct it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E:"LINE ...", "TABLE ...", "REPORT ...", "DATASET ...", "TEXTPOOL ...",&lt;/P&gt;&lt;P&gt;or "CURRENT LINE" expected after "READ".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its showing RED at this statement " &lt;SPAN class="L0S52"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;AND PSTNG_DATE &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;&amp;lt;fs_rp&amp;gt;&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;DATE0 &lt;SPAN class="L0S52"&gt;BINARY &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;SEARCH&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;.". in the first READ&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;This is the complete select : &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;SPAN class="L0S52"&gt;READ it_itab1 &lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;wa_itab1 &lt;SPAN class="L0S52"&gt;WHERE&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLANT &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;&amp;lt;fs_rp&amp;gt;&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;PLANT&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND&amp;nbsp; &lt;/SPAN&gt;MATERIAL &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;&amp;lt;fs_rp&amp;gt;&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;MATERIAL&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND &lt;/SPAN&gt;PSTNG_DATE &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;&amp;lt;fs_rp&amp;gt;&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;DATE0 &lt;SPAN class="L0S52"&gt;BINARY &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;SEARCH&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;Thanks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;DR&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2015 05:26:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143195#M1906328</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-21T05:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143196#M1906329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the easy way would be to declare &lt;SPAN style="color: #333333; font-size: 12px;"&gt;it_ITAB1 &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;as a sorted internal table with keys as PLANT MATERIAL AND PSTNG_DATE. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;So that &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;LOOP AT it_ITAB1 INTO wa_ITAB1 WHERE PLANT =&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt; font-size: 12px; color: #333333; background: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-PLANT&amp;nbsp; will use binary search algorithm when looping. This would be as good as using parallel cursor technique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie. data : it_itab1 type sorted table of ty_xxxx with unique/non-unique keys PLANT MATERIAL PSTNG_DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also declare itab2 and itab3 as sorted tables, with material as the key.&lt;/P&gt;&lt;P&gt;Check if the performance improves.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2015 06:26:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143196#M1906329</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-07-21T06:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143197#M1906330</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;Sry My mistake,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of &lt;STRONG&gt;where&lt;/STRONG&gt; use &lt;STRONG&gt;with key.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;like,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;READ it_itab1 &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;INTO &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;wa_itab1 &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;WITH KEY&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PLANT &lt;/SPAN&gt;&lt;SPAN class="L0S55" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&amp;lt;fs_rp&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="L0S70" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;PLANT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;AND&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;MATERIAL &lt;/SPAN&gt;&lt;SPAN class="L0S55" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&amp;lt;fs_rp&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="L0S70" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;MATERIAL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;AND &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;PSTNG_DATE &lt;/SPAN&gt;&lt;SPAN class="L0S55" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;&amp;lt;fs_rp&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="L0S70" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;-&lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 12px;"&gt;DATE0 &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;BINARY &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;SEARCH&lt;/SPAN&gt;&lt;SPAN class="L0S55" style="font-size: 12px; color: #333333; background: #ffffff;"&gt;.&lt;/SPAN&gt;&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;Hitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2015 07:12:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143197#M1906330</guid>
      <dc:creator>hitesh_gabani</dc:creator>
      <dc:date>2015-07-21T07:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP in LOOP, (self loop) performance tuning ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143198#M1906331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use below code..which is modified version of your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT: it_itab1 BY plant material pstng_date,movetype,&lt;/P&gt;&lt;P&gt;it_itab2 BY material,&lt;/P&gt;&lt;P&gt;it_itab3 BY material plant calmonth.&lt;/P&gt;&lt;P&gt;LOOP AT result_package ASSIGNING &amp;lt;fs_rp&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp; CLEAR: wa_itab1, wa_itab2, wa_itab3.&lt;/P&gt;&lt;P&gt;&amp;nbsp; LOOP AT it_itab1 INTO wa_itab1 WHERE plant = &amp;lt;fs_rp&amp;gt;-plant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND material = &amp;lt;fs_rp&amp;gt;-material&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND pstng_date = &amp;lt;fs_rp&amp;gt;-date0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND ( movetype EQ '312' OR movetype EQ '202' ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF wa_itab1-movetype EQ '312'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-/bic/yio_add = &amp;lt;fs_rp&amp;gt;-/bic/yio_add + wa_itab1-quant_b.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSEIF wa_itab1-movetype EQ '202'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-/bic/yio_sub = &amp;lt;fs_rp&amp;gt;-/bic/yio_sub + wa_itab1-quant_b.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ENDLOOP.&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF &amp;lt;fs_rp&amp;gt;-/bic/yioflag EQ 'Y'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; READ TABLE it_itab2 INTO wa_itab2 WITH KEY material = &amp;lt;fs_rp&amp;gt;-material BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-/bic/yioqntpr = wa_itab2-netprice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-loc_currcy = wa_itab2-loc_currcy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ELSEIF &amp;lt;fs_rp&amp;gt;-/bic/yioflag&amp;nbsp; EQ 'N'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; READ TABLE it_itab3 INTO wa_itab3 WITH KEY material =&amp;nbsp; &amp;lt;fs_rp&amp;gt;-material&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plant =&amp;nbsp; &amp;lt;fs_rp&amp;gt;-plant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; calmonth = &amp;lt;fs_rp&amp;gt;-calmonth&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BINARY SEARCH.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-/bic/yioqntpr = wa_itab3-price_val.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;fs_rp&amp;gt;-loc_currcy = wa_itab3-currency.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Praveer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2015 07:32:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-in-loop-self-loop-performance-tuning/m-p/11143198#M1906331</guid>
      <dc:creator>ipravir</dc:creator>
      <dc:date>2015-07-21T07:32:59Z</dc:date>
    </item>
  </channel>
</rss>

