Application Development and Automation 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: 
Read only

difference between break stop and exit

Former Member
0 Likes
2,507

hi friends,

what is the difference between break stop and exit statement.

thanks in advance.

regards,

bhaskar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,650

Hi,

BREAK is used to put hard break-point in the program

STOP is used to stop the program in start-of-selection...and if the END-OF-SELECTION is given..Then the control will go to that event if the STOP statement is used..

EXIT will exit depends on where you give..If given in an event...then it will exit out of the event..if given in a subroutine..it will come out of the subroutine..

Thanks,

Naren

8 REPLIES 8
Read only

Former Member
0 Likes
1,651

Hi,

BREAK is used to put hard break-point in the program

STOP is used to stop the program in start-of-selection...and if the END-OF-SELECTION is given..Then the control will go to that event if the STOP statement is used..

EXIT will exit depends on where you give..If given in an event...then it will exit out of the event..if given in a subroutine..it will come out of the subroutine..

Thanks,

Naren

Read only

Former Member
0 Likes
1,650

Stop : where ever you use stop command ,it will come to end-of-selection.

exit - if you use loop and endloop. ,it will come out from that loop.

if you use in perform routine,then it will come out from perform routine

if you use in function module ,then it will come out from function module

Read only

Former Member
0 Likes
1,650

Hi,

Stop : Can be used only in the following events - AT SELECTION-SCREEN (without additions), START-OF-SELECTION & GET. On encounterng STOP, it trigeers the END-OF-SELECTION immediately.

Exit: Within a Loop, it terminates the LOOP processing. In processing blocks, it ends the cureent processing block. It is recommended not to use EXIT in processing blocks.

Refer

EXIT

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/exit_.htm

STOP

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/stop.htm

Regards,

Padmam.

Read only

Former Member
0 Likes
1,650

Hi,

stop statement will stop the execution of the programme

and returns to selection screen.

and exit statment skips the loop like do or while or loop

and continues the further processing

reward points if helpful

regards,

venkatesh

Read only

Former Member
0 Likes
1,650

Hi Bhaskar,

<b>EXIT</b>

If the EXIT statement is executed outside of a loop, it will immediately terminate the current processing block.

After the processing 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.

<b>FOR STOP:</b>

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.

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'.

Read only

Former Member
0 Likes
1,650

hi,

<u><b>STOP</b></u>

If you use the <b>STOP</b> statement within an event block, the system stops processing the block immediately.

Before and during selection screen processing, the next event in the prescribed sequence is always called. From the AT SELECTION-SCREEN event onwards, the system always jumps from a STOP statement directly to the END-OF-SELECTION statement. Once the corresponding event block has been processed, the system displays the list.

<b>EXAMPLE TO STOP.</b>

REPORT EVENT_TEST.

NODES: SPFLI, SFLIGHT, SBOOK.

START-OF-SELECTION.

WRITE 'Test program for STOP'.

GET SBOOK.

WRITE: 'Bookid', SBOOK-BOOKID.

STOP.

END-OF-SELECTION.

WRITE: / 'End of Selection'.

This produces the following output:

Test Program for STOP

Bookid 00010001

End of Selection

As soon as the first line of SBOOK has been read, the system calls the END-OF-SELECTION event block.

<u><b>EXIT</b></u><b>I

f you use the STOP statement within an event block but not in a loop, the system stops processing the block immediately</b>. The ABAP runtime environment triggers the next event according to the following diagram:

<u><b>BREAK</b></u>

A break statement results in the termination of the statement to which it applies (switch, for, do, or while).

regards,

AshokReddy.

Read only

Former Member
0 Likes
1,650

BREAK - there is no keyword called break in abap rather u have CONTINUE.

STOP - when STOP is trigerred the cursor moves to the end of selection event.

EXIT = It is used to come out of the current loop.

REGARDS,

BALAJI. Assign points if its helpful

Read only

S0025444845
Active Participant
0 Likes
1,650

Hi,

stop will triffer END-OF_SELECTION event.

exit will take you out of the innermost loop.

and there is no break statement in abap.

regards,

sudha.

reward points if helpful