‎2007 Jul 20 7:49 AM
‎2007 Jul 20 7:56 AM
STOP will terminate the execution of that processing block and move to the next processing block. Stop can only be used in executable reports.
CONTINUE will by pass the remainder of the loop and move to the beginning of the loop for the next pass.
EXIT will terminate the loop and move to the first statement after the LOOP..ENDLOOP block.
‎2007 Jul 20 7:52 AM
Hi,
STOP
Effect
The statement STOP is only to be used in executable programs and in the following event blocks:
AT SELECTION-SCREEN (without additions)
START-OF-SELECTION
GET
You leave these event blocks via STOP, and the runtime environment triggers the event END-OF-SELECTION.
Note
The statement STOP is forbidden in methods and, since Release 6.10, leads to an uncatchable exception during the processing of screens called with CALL SCREEN and in programs not called with SUBMIT.
Example
Ending the event blocks GET sbook after max postings have been issued, and branching to END-OF-SELECTION.
CONTINUE
Effect
The CONTINUE statement can only be used in loops. If it is used, the current loop pass is ended immediately and the program flow is continued with the next loop pass.
Example
A loop pass is exited using CONTINUE if the loop index sy-index is an odd number.
DATA remainder TYPE i.
DO 20 TIMES.
remainder = sy-index MOD 2.
IF remainder <> 0.
CONTINUE.
ENDIF.
WRITE / sy-index.
ENDDO.
Thanks,
‎2007 Jul 20 7:53 AM
Hi Aarif,
Stop - stop the execution
exit - the execution will come out of loop
continue - The execution will stop for the current record in the loop and start executing the next record in the loop.
Regards
Arun
‎2007 Jul 20 7:53 AM
ABAP contains termination statements that allow you to terminate a loop prematurely. There are two categories of termination statement - those that only apply to the loop, and those that apply to the entire processing block in which the loop occurs. The STOP and REJECT statements belong to the latter group, and are described in more detail under Leaving Event Blocks.
The termination statements that apply only to the loop in which they occur are CONTINUE, CHECK, and EXIT. You can only use the CONTINUE statement in a loop. CHECK and EXIT, on the other hand, are context-sensitive. Within a loop, they only apply to the execution of the loop itself. Outside of a loop, they terminate the entire processing block in which they occur (subroutine, dialog module, event block, and so on).
CONTINUE, CHECK, and EXIT can be used in all four loop types in ABAP (DO, WHILE, LOOP, and SELECT).
To terminate a single loop pass immediately and unconditionally, use the CONTINUE statement in the statement block of the loop.
After the statement, the system ignores any remaining statements in the current statement block, and starts the next loop pass.
DO 4 TIMES.
IF SY-INDEX = 2.
CONTINUE.
ENDIF.
WRITE SY-INDEX.
ENDDO.
The output is:
1 3 4
The second loop pass is terminated without the WRITE statement being processed.
Terminating a Loop Pass Conditionally
To terminate a single loop pass conditionally, use the CHECK <condition> statement in the statement block of the loop.
If the condition is not true, any remaining statements in the current statement block after the CHECK statement are ignored, and the next loop pass starts. <condition> can be any logical expression.
DO 4 TIMES.
CHECK SY-INDEX BETWEEN 2 and 3.
WRITE SY-INDEX.
ENDDO.
The output is:
2 3
The first and fourth loop passes are terminated without the WRITE statement being processed, because SY-INDEX is not between 2 and 3.
Exiting a Loop
To terminate an entire loop immediately and unconditionally, use the EXIT statement in the statement block of the loop.
After this statement, the loop is terminated, and processing resumes after the closing statement of the loop structure (ENDDO, ENDWHILE, ENDLOOP, ENDSELECT). In nested loops, only the current loop is terminated.
DO 4 TIMES.
IF SY-INDEX = 3.
EXIT.
ENDIF.
WRITE SY-INDEX.
ENDDO.
The output is:
1 2
In the third loop pass, the loop is terminated before the WRITE statement is processed.
u can visit:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3564358411d1829f0000e829fbfe/content.htm
for further info
‎2007 Jul 20 7:56 AM
STOP will terminate the execution of that processing block and move to the next processing block. Stop can only be used in executable reports.
CONTINUE will by pass the remainder of the loop and move to the beginning of the loop for the next pass.
EXIT will terminate the loop and move to the first statement after the LOOP..ENDLOOP block.
‎2007 Jul 20 7:57 AM
<b>STOP </b>
Syntax
STOP.
Effect
The statement STOP is only to be used in executable programs and in the following event blocks:
AT SELECTION-SCREEN (without additions)
START-OF-SELECTION
GET
You leave these event blocks via STOP, and the runtime environment triggers the event END-OF-SELECTION.
Note
The statement STOP is forbidden in methods and, since Release 6.10, leads to an uncatchable exception during the processing of screens called with CALL SCREEN and in programs not called with SUBMIT.
<b>Example </b>
Ending the event blocks GET sbook after max postings have been issued, and branching to END-OF-SELECTION.
NODES: sflight, sbook.
DATA: bookings TYPE i,
max TYPE i VALUE 100.
GET sflight.
WRITE: / sflight-carrid, sflight-connid, sflight-fldate.
GET sbook.
bookings = bookings + 1.
WRITE: / sbook-bookid, sbook-customid.
IF bookings = max.
STOP.
ENDIF.
END-OF-SELECTION.
ULINE.
WRITE: / 'First', bookings, 'bookings'.
<b>EXIT - processing_block </b>
Syntax
EXIT.
Effect
If the EXIT statement is executed outside of a loop, it will immediately terminate the current processing block.
After the prodessing block has been executed, the runtime environment behaves in such a way that it follows with the exception Reporting Event Blocks START-OF-SELECTION and GET the schema from Leave Processing Blocks.
After the Reporting Processing Blocks START-OF-SELECTION and GET have been exited using EXIT, the runtime environment does not trigger any further reporting events. Instead, it directly calls the list processor for displaying the basic list.
Note
We recommend using EXIT only within loops (see EXIT (loops) ). Instead, use RETURN to leave processing blocks.
<b>BREAK-POINT </b>
Syntax
BREAK-POINT { [ID group]
| {[log_text] [AT NEXT APPLICATION STATEMENT]} }.
Extras:
1. ... ID group
2. ... log_text
3. ... AT NEXT APPLICATION STATEMENT
Effect
This statement defines an unconditional checkpoint (breakpoint). If the program reaches an active breakpoint during dialog processing, program execution is interrupted and the system switches to the ABAP Debugger. An inactive breakpoint will be ignored and program execution will continue with the statement following BREAK-POINT.
Without the ID addition, the breakpoint is always active. If the IDaddition is used, activation from outside the program will be controlled by a checkpoint group.
During background processing and during updating, program execution will not be interrupted. If the ID addition is specified, a breakpoint will always be inactive during breakpoint processing and during the updating process. If a breakpoint is always active, that is, the ID addition is not specified, the entry "Breakpoint reached" is written to the system log during background processing and during the udpate task. After the entry, the program name and the point where the breakpoint took place in the program are also recorded.
Addition 1
... ID group
Effect
The ID addition assigns the breakpoint to a checkpoint group group. The same rules apply to the checkpoint group and the activation settings as to the ASSERT statement.
Addition 2
... log_text
Effect
In log_text, a supplementary text for the system log can be specified. During dialog processing, the specification of log_text has no effect. During background processing and during the update task, the content of log_text in the system log is inserted between the words "Breakpoint" and "reached". For log_text, a flat, character-type data object with a length of 40 characters is expected. The specification of a data object of the type string is ignored.
Addition 3
... AT NEXT APPLICATION STATEMENT
Note
This addition is for internal use only.
It cannot be used in application programs
Effect
This statement is only useful in system programs, system modules, system subroutines, and system function modules whose name begins with %_ .
If system debugging is not switched on, the system will stop only at the next statement that is not in a system module.
If system debugging is switched on, the system will stop at the BREAK-POINT statement.
If system debugging is not switched on and the AT NEXT APPLICATION STATEMENT addition is not used, BREAK-POINT statements are ignored in system modules.
Notes
A breakpoint in SELECT loops can cause an exception through the loss of the database cursor. The reason for this is that, during debugging, a database commit could be triggered.
In the ABAP Editor and in the ABAP Debugger, dynamic breakpoints can be used and managed without changing the source code. These are effective, at maximum, to the end of a user session.
A breakpoint that is always active is used solely as a test help and is not allowed in productive programs. The BREAK-POINT statement without the ID addition therefore causes an error in the enhanced program check.
BREAK, followed by a user name, is not a statement, but a predefined macro.
In http sessions ( BSP), the system will stop at the BREAK-POINT statement only if, before execution, additional dynamic http breakpoints are set in the editor of an BSP page. Otherwise, only one entry is written to the system log.
Regards,
Pavan
‎2007 Jul 20 7:59 AM
Hi,
STOP :This statement terminates a processing block in an excutable
program.
The statement is only intended for use in the INITIALIZATION,
AT SELECTION-SCREEN, START-OF-SELECTION, and GET events. It
terminates the current processing block in an executable
program and triggers the END-OF-SELECTION event. In all other
processing blocks, or when you do not want to trigger the
END-OF-SELECTION event, you must use EXIT.
EXIT.
- Within a loop structure:
Terminates looop processing (DO, WHILE, LOOP, SELECT).
- Within subroutines and other modularization units (but not
in a loop structure):
Leaves the subroutine or modularization unit (FORM, MODULE,
FUNCTION, TOP-OF-PAGE, END-OF-PAGE).
- Outside loop structures and modularization units (report
processing):
Terminates report processing and triggers list display.
DATA: SAP_COUNT TYPE I,
WA_T100 TYPE T100.
SELECT * FROM T100 INTO WA_T100 WHERE SPRSL = SY-LANGU AND
ARBGB = 'DS'.
WRITE / WA_T100-TEXT.
IF WA_T100-TEXT CS 'SAP'.
ADD 1 TO SAP_COUNT.
IF SAP_COUNT = 3.
EXIT.
ENDIF.
ENDIF.
ENDSELECT.
CONTINUE.
Within loop structures like
- DO ... ENDDO
- WHILE ... ENDWHILE
- LOOP ... ENDLOOP
- SELECT ... ENDSELECT
CONTINUE terminates the current loop pass, returns the
processing to the beginning of the loop and starts the nex
loop pass, if there is one.
DO loop: Omit an area (10 ... 20)
DO 100 TIMES.
IF SY-INDEX >= 10 AND SY-INDEX <= 20.
CONTINUE.
ENDIF.
...
ENDDO.
Regards,
Priyanka.