<?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: exit in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666614#M295029</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Terminating Loops&lt;/P&gt;&lt;P&gt;ABAP contains termination statements that allow you to terminate a loop prematurely. There are&lt;/P&gt;&lt;P&gt;two categories of termination statement - those that only apply to the loop, and those that apply&lt;/P&gt;&lt;P&gt;to the entire processing block in which the loop occurs. The STOP and REJECT statements&lt;/P&gt;&lt;P&gt;belong to the latter group, and are described in more detail under Leaving Event Blocks [Page&lt;/P&gt;&lt;P&gt;966].&lt;/P&gt;&lt;P&gt;The termination statements that apply only to the loop in which they occur are CONTINUE,&lt;/P&gt;&lt;P&gt;CHECK, and EXIT. You can only use the CONTINUE statement in a loop. CHECK and EXIT, on&lt;/P&gt;&lt;P&gt;the other hand, are context-sensitive. Within a loop, they only apply to the execution of the loop&lt;/P&gt;&lt;P&gt;itself. Outside of a loop, they terminate the entire processing block in which they occur&lt;/P&gt;&lt;P&gt;(subroutine, dialog module, event block, and so on).&lt;/P&gt;&lt;P&gt;CONTINUE, CHECK, and EXIT can be used in all four loop types in ABAP (DO, WHILE, LOOP,&lt;/P&gt;&lt;P&gt;and SELECT).&lt;/P&gt;&lt;P&gt;Terminating a Loop Pass Unconditionally&lt;/P&gt;&lt;P&gt;To terminate a single loop pass immediately and unconditionally, use the CONTINUE statement&lt;/P&gt;&lt;P&gt;in the statement block of the loop.&lt;/P&gt;&lt;P&gt;After the statement, the system ignores any remaining statements in the current statement block,&lt;/P&gt;&lt;P&gt;and starts the next loop pass.&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;IF SY-INDEX = 2.&lt;/P&gt;&lt;P&gt;CONTINUE.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;WRITE SY-INDEX.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;1 3 4&lt;/P&gt;&lt;P&gt;The second loop pass is terminated without the WRITE statement being processed.&lt;/P&gt;&lt;P&gt;Terminating a Loop Pass Conditionally&lt;/P&gt;&lt;P&gt;To terminate a single loop pass conditionally, use the CHECK &amp;lt;condition&amp;gt; statement in the&lt;/P&gt;&lt;P&gt;statement block of the loop.&lt;/P&gt;&lt;P&gt;If the condition is not true, any remaining statements in the current statement block after the&lt;/P&gt;&lt;P&gt;CHECK statement are ignored, and the next loop pass starts. &amp;lt;condition&amp;gt; can be any logical&lt;/P&gt;&lt;P&gt;expression [Page 225].&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;CHECK SY-INDEX BETWEEN 2 and 3.&lt;/P&gt;&lt;P&gt;WRITE SY-INDEX.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;2 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first and fourth loop passes are terminated without the WRITE statement being&lt;/P&gt;&lt;P&gt;processed, because SY-INDEX is not between 2 and 3.&lt;/P&gt;&lt;P&gt;Exiting a Loop&lt;/P&gt;&lt;P&gt;To terminate an entire loop immediately and unconditionally, use the EXIT statement in the&lt;/P&gt;&lt;P&gt;statement block of the loop.&lt;/P&gt;&lt;P&gt;After this statement, the loop is terminated, and processing resumes after the closing statement&lt;/P&gt;&lt;P&gt;of the loop structure (ENDDO, ENDWHILE, ENDLOOP, ENDSELECT). In nested loops, only the&lt;/P&gt;&lt;P&gt;current loop is terminated.&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;IF SY-INDEX = 3.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;WRITE SY-INDEX.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;1 2&lt;/P&gt;&lt;P&gt;In the third loop pass, the loop is terminated before the WRITE statement is&lt;/P&gt;&lt;P&gt;processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Nov 2006 12:03:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-16T12:03:46Z</dc:date>
    <item>
      <title>exit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666613#M295028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what are the functions of EXIT,STOP,CHECK,CONTINUE?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 12:01:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666613#M295028</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T12:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: exit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666614#M295029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Terminating Loops&lt;/P&gt;&lt;P&gt;ABAP contains termination statements that allow you to terminate a loop prematurely. There are&lt;/P&gt;&lt;P&gt;two categories of termination statement - those that only apply to the loop, and those that apply&lt;/P&gt;&lt;P&gt;to the entire processing block in which the loop occurs. The STOP and REJECT statements&lt;/P&gt;&lt;P&gt;belong to the latter group, and are described in more detail under Leaving Event Blocks [Page&lt;/P&gt;&lt;P&gt;966].&lt;/P&gt;&lt;P&gt;The termination statements that apply only to the loop in which they occur are CONTINUE,&lt;/P&gt;&lt;P&gt;CHECK, and EXIT. You can only use the CONTINUE statement in a loop. CHECK and EXIT, on&lt;/P&gt;&lt;P&gt;the other hand, are context-sensitive. Within a loop, they only apply to the execution of the loop&lt;/P&gt;&lt;P&gt;itself. Outside of a loop, they terminate the entire processing block in which they occur&lt;/P&gt;&lt;P&gt;(subroutine, dialog module, event block, and so on).&lt;/P&gt;&lt;P&gt;CONTINUE, CHECK, and EXIT can be used in all four loop types in ABAP (DO, WHILE, LOOP,&lt;/P&gt;&lt;P&gt;and SELECT).&lt;/P&gt;&lt;P&gt;Terminating a Loop Pass Unconditionally&lt;/P&gt;&lt;P&gt;To terminate a single loop pass immediately and unconditionally, use the CONTINUE statement&lt;/P&gt;&lt;P&gt;in the statement block of the loop.&lt;/P&gt;&lt;P&gt;After the statement, the system ignores any remaining statements in the current statement block,&lt;/P&gt;&lt;P&gt;and starts the next loop pass.&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;IF SY-INDEX = 2.&lt;/P&gt;&lt;P&gt;CONTINUE.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;WRITE SY-INDEX.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;1 3 4&lt;/P&gt;&lt;P&gt;The second loop pass is terminated without the WRITE statement being processed.&lt;/P&gt;&lt;P&gt;Terminating a Loop Pass Conditionally&lt;/P&gt;&lt;P&gt;To terminate a single loop pass conditionally, use the CHECK &amp;lt;condition&amp;gt; statement in the&lt;/P&gt;&lt;P&gt;statement block of the loop.&lt;/P&gt;&lt;P&gt;If the condition is not true, any remaining statements in the current statement block after the&lt;/P&gt;&lt;P&gt;CHECK statement are ignored, and the next loop pass starts. &amp;lt;condition&amp;gt; can be any logical&lt;/P&gt;&lt;P&gt;expression [Page 225].&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;CHECK SY-INDEX BETWEEN 2 and 3.&lt;/P&gt;&lt;P&gt;WRITE SY-INDEX.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;2 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first and fourth loop passes are terminated without the WRITE statement being&lt;/P&gt;&lt;P&gt;processed, because SY-INDEX is not between 2 and 3.&lt;/P&gt;&lt;P&gt;Exiting a Loop&lt;/P&gt;&lt;P&gt;To terminate an entire loop immediately and unconditionally, use the EXIT statement in the&lt;/P&gt;&lt;P&gt;statement block of the loop.&lt;/P&gt;&lt;P&gt;After this statement, the loop is terminated, and processing resumes after the closing statement&lt;/P&gt;&lt;P&gt;of the loop structure (ENDDO, ENDWHILE, ENDLOOP, ENDSELECT). In nested loops, only the&lt;/P&gt;&lt;P&gt;current loop is terminated.&lt;/P&gt;&lt;P&gt;DO 4 TIMES.&lt;/P&gt;&lt;P&gt;IF SY-INDEX = 3.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;WRITE SY-INDEX.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;The output is:&lt;/P&gt;&lt;P&gt;1 2&lt;/P&gt;&lt;P&gt;In the third loop pass, the loop is terminated before the WRITE statement is&lt;/P&gt;&lt;P&gt;processed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 12:03:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666614#M295029</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-16T12:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: exit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666615#M295030</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;1)   EXIT if in a loop endloop exits the loop, if in a procedure then exits the procedure. Any where else it exits the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) STOP if executed in an executable program then its exits the processing block and then goes to the END-OF-SELECTION block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) CONTINUE can only be used in loops, this statement is used to stop the current loop pass and proceed with the next loop pass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) CHECK in a loop will stop the current loop pass and goes to the next loop pass if the logical condition is false else does nothing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Seshatalpasai Madala&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Nov 2006 12:06:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666615#M295030</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2006-11-16T12:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: exit</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666616#M295031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Madhav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you need to go for Training  .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Nov 2006 00:03:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exit/m-p/1666616#M295031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-17T00:03:00Z</dc:date>
    </item>
  </channel>
</rss>

