<?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: Exiting a loop within a loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914085#M57714</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code will take away lots of performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all you can use LOOP AT ITAB where &amp;lt;Condn&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the CHECK can be replaced by IF ... ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please derive the program logic as per the need. I hope the above points helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Murugesh AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Feb 2005 16:13:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-02-10T16:13:29Z</dc:date>
    <item>
      <title>Exiting a loop within a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914084#M57713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howdy again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just a quick question:&lt;/P&gt;&lt;P&gt;I've got the following loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;loop at bool_data-bseg into bseg.&lt;/P&gt;&lt;P&gt;  check bseg-bukrs = '4001'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab_setleaf_type.&lt;/P&gt;&lt;P&gt;  check bkpf-blart LE itab_setleaf_type-valto.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab_setleaf_vend.&lt;/P&gt;&lt;P&gt;  check bseg-lifnr LE itab_setleaf_vend-valto.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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;for the two loops within the main loop I weant the program to go onto the next record in the main loop.&lt;/P&gt;&lt;P&gt;Would using check do this - I don't think so...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know a command that would?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 16:04:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914084#M57713</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T16:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Exiting a loop within a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914085#M57714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following code will take away lots of performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all you can use LOOP AT ITAB where &amp;lt;Condn&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the CHECK can be replaced by IF ... ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please derive the program logic as per the need. I hope the above points helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Murugesh AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 16:13:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914085#M57714</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T16:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Exiting a loop within a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914086#M57715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with Murugresh on the performance part.As far as coming out of inner loop use EXIT statement with if conditions. (Will come out only from inner loop.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 16:21:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914086#M57715</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T16:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Exiting a loop within a loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914087#M57716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Jeet pointed out, EXIT inside a LOOP will terminate the LOOP and continue executing at the next statement following ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For reference, I will call your loops - 1, 2 and 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in loop 2, if you EXIT, then execution would continue with loop 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want the EXIT in loop 2 to skip loop 3 and continue loop 1, then you will need a flag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP 1
Flag = 'Y'.
  LOOP 2.
    IF ...
      Flag = 'N'.
      EXIT.
    ENDIF.
  ENDLOOP.
  IF Flag = 'N'.
    CONTINUE.
  ENDIF.
  LOOP 3.
    IF ...
      EXIT.
    ENDIF.
  ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2005 16:32:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exiting-a-loop-within-a-loop/m-p/914087#M57716</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-02-10T16:32:36Z</dc:date>
    </item>
  </channel>
</rss>

