<?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: Replacing 'Loop' with 'Do'... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258706#M146941</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;I was told that what I had earlier with 'Loop' is fine, but 'DO/ENDO' is better in terms of performance and that doing 'Loop' within another loop is not good practice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you guyz suggest that I leave it with 'Loop', then let me know, and I won't change it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Apr 2006 20:01:59 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-04-12T20:01:59Z</dc:date>
    <item>
      <title>Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258699#M146934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I replace the following with DO/ENDO?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop&amp;lt;/b&amp;gt; at i_po_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        v_length = strlen( v_text ).&lt;/P&gt;&lt;P&gt;        if v_length &amp;gt; 6000.&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;        concatenate v_text i_po_text-tdline into v_text  separated by space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        move: v_text to i_matl_details-po_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      &amp;lt;b&amp;gt;endloop.&amp;lt;/b&amp;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;Fred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 18:25:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258699#M146934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T18:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258700#M146935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fred, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ Table i_PO_TEXT index sy-index.&lt;/P&gt;&lt;P&gt;v_length = strlen( v_text ).&lt;/P&gt;&lt;P&gt;if v_length &amp;gt; 6000.&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;concatenate v_text i_po_text-tdline into v_text separated by space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move: v_text to i_matl_details-po_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note :Please mark the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 18:28:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258700#M146935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T18:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258701#M146936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ table i_po_text index sy-index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate v_text i_po_text-tdline into v_text separated by space.&lt;/P&gt;&lt;P&gt;move: v_text to i_matl_details-po_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_length = strlen( v_text ).&lt;/P&gt;&lt;P&gt;if v_length &amp;gt; 6000.&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;enddo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 18:29:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258701#M146936</guid>
      <dc:creator>LucianoBentiveg</dc:creator>
      <dc:date>2006-04-12T18:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258702#M146937</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;PRE&gt;&lt;CODE&gt;data: v_lines type i.


describe table i_po_text lines v_lines.

DO v_lines times.
read table i_po_text index sy-index.
if sy-subrc = 0.
v_length = strlen( v_text ).
if v_length &amp;gt; 6000.
exit.
endif.

concatenate v_text i_po_text-tdline into v_text separated by space.

move: v_text to i_matl_details-po_text.

endif.
enddo.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 18:29:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258702#M146937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T18:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258703#M146938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My 2 cents:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DO.
  READ TABLE i_po_text INDEX sy-index.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    EXIT.
  ENDIF.

  v_length = strlen( v_text ).
  IF v_length &amp;gt; 6000.
    EXIT.
  ENDIF.

  CONCATENATE v_text i_po_text-tdline INTO v_text SEPARATED BY space.

  MOVE: v_text TO i_matl_details-po_text.

ENDDO.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 18:36:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258703#M146938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T18:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258704#M146939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But why do you want to do this? The LOOP is roughly twice as fast as the DO.&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, 12 Apr 2006 19:26:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258704#M146939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T19:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258705#M146940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Rob. I don't see why you need to replace the LOOP with DO. Something like you did before should be fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT i_po_text.
  CONCATENATE v_text i_po_text-tdline 
         INTO v_text SEPARATED BY space.
  &amp;lt;b&amp;gt;CONDENSE v_text.&amp;lt;/b&amp;gt;
  v_length = STRLEN( v_text ).
  IF v_length &amp;gt; 6000.
    EXIT.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 19:32:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258705#M146940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T19:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258706#M146941</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;I was told that what I had earlier with 'Loop' is fine, but 'DO/ENDO' is better in terms of performance and that doing 'Loop' within another loop is not good practice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you guyz suggest that I leave it with 'Loop', then let me know, and I won't change it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 20:01:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258706#M146941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T20:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258707#M146942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't change it. I did test it and the loop is faster. Nested loops should be avoided.&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, 12 Apr 2006 20:10:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258707#M146942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T20:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258708#M146943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am assuming you are talking in the context of your program that reads the change documents to find all the materials that changed. You then pull information regarding all those materials from the materials master tables except the PO text which you are getting from calling READ_TEXT. Here you get the text in an internal table and you want to convert that into a string before updating your final internal table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at materials_that_changed.
  get po text in internal table for the current loop 
  material.
  loop at the potext internal table.
    prepare the string.
  endloop.
  move the string to materials_that_changed internal 
  table field, po_text.
  modify.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this accurate description?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is true, doing a loop within a loop will not hurt the performance, because at any point of time, your po_text internal table will contain only the text for one material and I guess that should not be more than a couple of records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Srinivas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 20:12:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258708#M146943</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T20:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258709#M146944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Srinivas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes that description is true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll take Rob and your advice and not change my original loop statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your replies and help very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Fred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 20:18:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258709#M146944</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T20:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258710#M146945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my description of your program logic, you have to make sure that you &amp;lt;b&amp;gt;&amp;lt;u&amp;gt;refresh the contents of po_text for each material&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;. Otherwise you will end up accumulating all the texts for all the materials as you loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 20:25:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258710#M146945</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T20:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258711#M146946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Srinivas is correct - it's only when both tables become large that problems arise with 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, 12 Apr 2006 20:36:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258711#M146946</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T20:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing 'Loop' with 'Do'...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258712#M146947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I am already refreshing the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Apr 2006 20:59:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/replacing-loop-with-do/m-p/1258712#M146947</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-12T20:59:37Z</dc:date>
    </item>
  </channel>
</rss>

