Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Differences

Former Member
0 Kudos

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?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

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.

S0025444845
Active Participant
0 Kudos

hi,

EXIT will take you out of the innermost loop or perform.

STOP will take you to the END-OF-SELECTION event.

regards,

sudha

Former Member
0 Kudos

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