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: 

what is difference between 'exit' and 'stop' commands..?

Former Member
0 Kudos

Hi experts,

I am Siva Reddy,

I am new to ABAP ,

I have one doubt...

"what is the difference between 'exit' and 'stop' commands?

If u know the answer please mail me.

Points will be given to clear answers..

Regards,

Siva Reddy.

6 REPLIES 6

Former Member
0 Kudos

hi.

EXIT:

If the EXIT statement is listed within a loop, it leaves the loop by ending the current loop process. Program execution is continued after the closing statement in the loop.

Outside of a loop, the EXIT statement leaves the current processing block (see EXIT - Processing block). Its recommend that you use EXIT within loops only.

STOP:

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.

Thanks.

Former Member
0 Kudos

Hi,

EXIT : It passes control immeditely to the and loop and begins a new loop pass.

STOP : It stops further processing

Reward points if helpful.

REGARDS.

SRIKANTA GOPE

Former Member
0 Kudos

Hi,

The exit command when used inside a loop will come out of the loop and execute the statement which is after the loop.When used inside a subroutine it will come out of routine and go to the next routine.

The stop command when used inside the subroutine will come out of the subroutine and also out of the event(e.g. start-of-selection) and go to the next event (e.g end-of-selection).The stop command when used in the loop will stop the processing of the loop and the subroutine in which the loop comes.

Thanks,

Sandeep.

Former Member
0 Kudos

Hi,

Exit - will come out of the loop or Subroutine.

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 - will stop the program at that point itself.

This statement terminates a processing block in an excutable program.

Reward if helpful.

sivapuram_phanikumar
Active Participant
0 Kudos

Hi,

EXIT command exits from the current loop/routine where as STOP stops from further processing....

Regards,

Phani

Former Member
0 Kudos

hi

EXIT:

If the EXIT statement is listed within a loop, it leaves the loop by ending the current loop process. Program execution is continued after the closing statement in the loop.

ex:

DATA limit TYPE i VALUE 10.

DO.

IF sy-index > limit.

EXIT.

ENDIF.

WRITE / sy-index.

ENDDO.

output: 1 to 10.

stop:

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.

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

once no of bookings is equal to max(100).

then end of selection will be triggered.

output:

-


first 100.

reward if useful.