06-12-2007 1:10 PM
Hi All,
What are the exact difference between EXIT STOP REJECT and RETURN statements?How will it work when it is given inside the loop?
06-12-2007 1:18 PM
Hi,
From the SAP F1 Help:
Basic form EXIT.
Effect - 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.
STOP.
This statement is not allowed in an ABAP Objects context. Se
STOP not allowed.
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.
Reject:The REJECT statement exits the current GET event block of an executable program. If you do not specify node, the runtime environment responds as described in Exiting Processing Blocks.
The REJECT statement always refers to the current GET event, not to the location where it is executed. If you call a procedure in a GET event block, and the REJECT statement is executed there, the calling event block is affected.
Return:
This statement immediately ends the current processing block. It can appear in any area of a processing block and ends this block regardless of which statement block or control structure the statement is in.
After leaving the processing block, the runtime environment, except for the reporting event blockSTART-OF-SELECTION, follows the schema in Leave processing blocks.
After you end the reporting event block START-OF-SELECTIONwith RETURN, the runtime environment does not trigger any further reporting events, rather, it calls the list processor directly to display the basic list.
<b>Reward points</b>
Regards
06-12-2007 1:13 PM
Hi
Stop: goes to end of selection
Exit: exits that loop pass
Reject:The REJECT statement exits the current GET event block of an executable program. If you do not specify node, the runtime environment responds as described in Exiting Processing Blocks.
The REJECT statement always refers to the current GET event, not to the location where it is executed. If you call a procedure in a GET event block, and the REJECT statement is executed there, the calling event block is affected.
Return:
This statement immediately ends the current processing block. It can appear in any area of a processing block and ends this block regardless of which statement block or control structure the statement is in.
After leaving the processing block, the runtime environment, except for the reporting event blockSTART-OF-SELECTION, follows the schema in Leave processing blocks.
After you end the reporting event block START-OF-SELECTIONwith RETURN, the runtime environment does not trigger any further reporting events, rather, it calls the list processor directly to display the basic list.
<b>Reward points for useful Answers</b>
Regards
Anji
06-12-2007 1:14 PM
Hi,
EXIT is used to exit from LOOP, PROCEDURE or Function MODULE or PROGRAM.
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.
REJECT Is also to be used in the Logical database programs.The REJECT statement always refers to the current GET event, not to the location where it is executed.
RETURN statement is used to return to the calling program from the called program. Also to exit the current processing block.
Regards,
Sesh
Message was edited by:
Seshatalpasai Madala
06-12-2007 1:14 PM
hi,
exit: comes out of loop and continues with next statement after the loop.
stop: comes out of loop and goes to end-of-selection event.
return: used to pass values from subroutines to main function or to calling area.
if helpful reward some points.
with regards,
suresh.
06-12-2007 1:16 PM
hi,
EXIT will take you out of the innermost loop or perform.
STOP will take you to the END-OF-SELECTION event.
regards,
sudha
06-12-2007 1:17 PM
06-12-2007 1:18 PM
Hi,
From the SAP F1 Help:
Basic form EXIT.
Effect - 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.
STOP.
This statement is not allowed in an ABAP Objects context. Se
STOP not allowed.
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.
Reject:The REJECT statement exits the current GET event block of an executable program. If you do not specify node, the runtime environment responds as described in Exiting Processing Blocks.
The REJECT statement always refers to the current GET event, not to the location where it is executed. If you call a procedure in a GET event block, and the REJECT statement is executed there, the calling event block is affected.
Return:
This statement immediately ends the current processing block. It can appear in any area of a processing block and ends this block regardless of which statement block or control structure the statement is in.
After leaving the processing block, the runtime environment, except for the reporting event blockSTART-OF-SELECTION, follows the schema in Leave processing blocks.
After you end the reporting event block START-OF-SELECTIONwith RETURN, the runtime environment does not trigger any further reporting events, rather, it calls the list processor directly to display the basic list.
<b>Reward points</b>
Regards