<?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: Tuning performance for Loop inside loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266402#M1018027</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do this way&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT LT_SAP_DATA INTO LS_SAP_DATA.
IF NOT LS_SAP_DATA-NAME1 IS INITIAL.
 
 CONDENSE LS_SAP_DATA-NAME1 NO-GAPS.
 TRANSLATE LS_SAP_DATA-NAME1 TO 
 LOWER CASE.
 
  READ TABLE LT_LEGACY_DATA INTO
  LS_LEGACY_DATA
   WITH KEY VENDORNAME = LS_SAP_DATA-NAME1.
 
 IF SY-SUBRC EQ 0. 
   Here i am capturing based on the comparison.
 ENDIF.

ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Aug 2008 03:21:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-05T03:21:30Z</dc:date>
    <item>
      <title>Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266400#M1018025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing a report to compare the uploaded legacy vendor data with that of existing vendor data in sap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So one of the comparision is name, i am doing like below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT LT_SAP_DATA INTO LS_SAP_DATA.
IF NOT LS_SAP_DATA-NAME1 IS INITIAL.

 CONDENSE LS_SAP_DATA-NAME1 NO-GAPS.
 TRANSLATE LS_SAP_DATA-NAME1 TO 
 LOWER CASE.

  READ TABLE LT_LEGACY_DATA INTO
  LS_LEGACY_DATA
   WITH KEY VENDORNAME = LS_SAP_DATA-NAME1.

IF SY-SUBRC NE 0.
LOOP AT LT_LEGACY_DATA INTO LS_LEGACY_DATA
            WHERE VENDORNAME CS LS_SAP_DATA-NAME1.

Here i am capturing based on the comparison.

ENDLOOP.

ENDIF.
ENDIF.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but for 15000 legacy data and 15000 SAP data if i am comparing with name, with loop inside loop, its going for time out error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any better way of doing this other than uploading legacy data in smaller chunks?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this is highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Simha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2008 03:00:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266400#M1018025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-05T03:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266401#M1018026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Simha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding nested loop the blog of Rob Burbank [SAP Network Blog: Performance of Nested Loops|&lt;A class="jive_macro jive_macro_blogpost" href="https://community.sap.com/" __jive_macro_name="blogpost" modifiedtitle="true" __default_attr="41337"&gt;&lt;/A&gt;] is a "Must Read".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2008 03:18:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266401#M1018026</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-08-05T03:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266402#M1018027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do this way&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT LT_SAP_DATA INTO LS_SAP_DATA.
IF NOT LS_SAP_DATA-NAME1 IS INITIAL.
 
 CONDENSE LS_SAP_DATA-NAME1 NO-GAPS.
 TRANSLATE LS_SAP_DATA-NAME1 TO 
 LOWER CASE.
 
  READ TABLE LT_LEGACY_DATA INTO
  LS_LEGACY_DATA
   WITH KEY VENDORNAME = LS_SAP_DATA-NAME1.
 
 IF SY-SUBRC EQ 0. 
   Here i am capturing based on the comparison.
 ENDIF.

ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;raam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2008 03:21:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266402#M1018027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-05T03:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266403#M1018028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is a small change in my code which i didn't paste earlier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am taking if read is successful at fist instance and even if read is unsuccessful then only i am going for nested loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT LT_SAP_DATA INTO LS_SAP_DATA.
IF NOT LS_SAP_DATA-NAME1 IS INITIAL.
 
 CONDENSE LS_SAP_DATA-NAME1 NO-GAPS.
 TRANSLATE LS_SAP_DATA-NAME1 TO 
 LOWER CASE.
 
  READ TABLE LT_LEGACY_DATA INTO
  LS_LEGACY_DATA
   WITH KEY VENDORNAME = LS_SAP_DATA-NAME1.
 
 IF SY-SUBRC EQ 0. 
   Here i am capturing based on the comparison.
 ELSE.
     LOOP AT LT_LEGACY_DATA_FRMT INTO LS_LEGACY_DATA
            WHERE VENDORNAME CS LS_SAP_DATA-NAME1.
      ENDLOOP.
 ENDIF.
 
ENDIF.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2008 04:24:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266403#M1018028</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-05T04:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266404#M1018029</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;This could be useful to u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Entries: 100 (ITAB1), 1000 (ITAB2)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Line width: 100&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Both tables sorted by key K&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I = 1.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1 INTO WA1.&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB2 INTO WA2 FROM I.&lt;/P&gt;&lt;P&gt;    IF WA2-K &amp;lt;&amp;gt; WA1-K.&lt;/P&gt;&lt;P&gt;      I = SY-TABIX.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    " ...&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;Rgds.,&lt;/P&gt;&lt;P&gt;subash&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Aug 2008 04:30:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266404#M1018029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-05T04:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266405#M1018030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Uwe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for that input.&lt;/P&gt;&lt;P&gt;I read the blog from Rob Burbank and was quiet informative, but here in my case i can neither user Parallel cursor or Indexed loop as i am comparing the names with operator 'CS', so i can't neglect already looped iterations by catching the index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any other efficient way?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Simha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2008 01:11:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266405#M1018030</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-06T01:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266406#M1018031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Simha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At least you can do some tuning of your coding which might help to overcome the timeout:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: ld_idx      TYPE i,
          ld_next     TYPE i.

SORT lt_legacy_data BY vendorname.  " for BINARY SEARCH

LOOP AT LT_SAP_DATA INTO LS_SAP_DATA
               WHERE NOT ( name1 IS INITIAL ). 
" IF NOT LS_SAP_DATA-NAME1 IS INITIAL.
 
 CONDENSE LS_SAP_DATA-NAME1 NO-GAPS.
 TRANSLATE LS_SAP_DATA-NAME1 TO 
 LOWER CASE.
 
  READ TABLE LT_LEGACY_DATA INTO
  LS_LEGACY_DATA
   WITH KEY vendorname = LS_SAP_DATA-NAME1
   BINARY SEARCH.
 
  IF SY-SUBRC NE 0.
    LOOP AT LT_LEGACY_DATA INTO LS_LEGACY_DATA
            WHERE VENDORNAME CS LS_SAP_DATA-NAME1.
 
"Here i am capturing based on the comparison.
 
  ENDLOOP.
 
  ENDIF.
"ENDIF.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2008 03:35:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266406#M1018031</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-08-06T03:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Tuning performance for Loop inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266407#M1018032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Uwe, i will sort and read with binary search but can't loop with where condition as i am having other validations before comparing with Name so have to loop with out any conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am closing this thread as answered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Aug 2008 06:59:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/tuning-performance-for-loop-inside-loop/m-p/4266407#M1018032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-06T06:59:14Z</dc:date>
    </item>
  </channel>
</rss>

