Skip to Content
author's profile photo Former Member
Former Member

exit /stop difference

plz tell me the difference between exit and stop when used in different situations like inside loop,i the program etc.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

10 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2007 at 01:12 PM

    Hi ,

    where ever we use STOP control will directly come to END-OF-SELECTION.

    EXIT just comes out from the loop. Award point if it is useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2007 at 12:03 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 11, 2007 at 12:05 PM

    HI,

    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.

    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). We recommend that you use EXIT within loops only.

    GET is keyword used in logical database programs.

    Best Regards,

    Sesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2007 at 12:06 PM

    Hi,

    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.

    Hope this helps you.

    regards,

    kumar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2007 at 12:15 PM

    Hi Pavan,

    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.

    Reward all helpful answers!!!!

    Younus

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2007 at 12:22 PM

    STOP : Terminates a processing block of code in an executable

    program [report programs]

    EXIT: used to come out of progarm if it is used any where in a program.

    if helpful reward some points.

    with regards,

    suresh babu aluri.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2007 at 01:12 PM

    Hi ,

    where ever we use STOP control will directly come to END-OF-SELECTION.

    EXIT just comes out from the loop. Award point if it is useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 11, 2007 at 07:27 PM

    Hi,

    EXIT:

    A subroutine normally ends at the ENDFORM statement. However, you can terminate them

    earlier by using the EXIT or CHECK statement. When you terminate a subroutine with EXIT or

    CHECK, the current values of the output parameters (CHANGING parameters passed by value)

    are passed back to the corresponding actual parameter.

    Use EXIT to terminate a subroutine unconditionally. The calling program regains control at the

    statement following the PERFORM statement.

    Ex.

    PROGRAM FORM_TEST.

    PERFORM TERMINATE.

    WRITE 'The End'.

    FORM TERMINATE.

    WRITE '1'.

    WRITE '2'.

    WRITE '3'.

    EXIT.

    WRITE '4'.

    ENDFORM.

    The produces the following output:

    1 2 3 The End

    STOP:

    If you use the STOP statement within an event block, the system stops processing the block

    immediately.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 10:28 AM

    hai,

    when stop is used in loop it simply comes out of the loop or else in a program it reaches the end of selection screen whereas exit gets the control to the next loop in a program

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 10:38 AM

    HI .

    Leaving Event Blocks Using STOP

    If you use the STOP statement within an event block, the system stops processing the block immediately. The ABAP runtime environment triggers the next event according to the following diagram:

    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.

    The following program is connected to the logical database F1S.

    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.

    Exiting Event Blocks Using EXIT

    If you use the EXIT statement within an event block but not in a loop, the system stops processing the block immediately. The ABAP runtime environment triggers the next event according to the following diagram:

    Before and during selection screen processing, the next event in the prescribed sequence is always called. From the START-OF-SELECTION event onwards, the system starts the list processor directly when the EXITstatement occurs, and displays the list.

    If the EXIT statement occurs inside a DO, WHILE, or LOOP loop, it is the loop that terminates, not the processing block.

    The following executable program is connected to the logical database F1S.

    REPORT demo_program_exit_1.

    NODES: spfli, sflight, sbook.

    START-OF-SELECTION.

    WRITE 'Test Program for EXIT'.

    GET sbook.

    WRITE: 'Bookid', sbook-bookid.

    EXIT.

    END-OF-SELECTION.

    WRITE: / 'End of selection'.

    This produces the following output:

    Test Program for EXIT

    Bookid 00010001

    After the first line of SBOOK has been read, the list is displayed immediately.

    The following executable program is connected to the logical database F1S.

    REPORT demo_program_exit_2.

    NODES: spfli, sflight, sbook.

    DATA flag(1) TYPE c.

    AT SELECTION-SCREEN.

    IF carrid-low IS INITIAL.

    flag = 'X'.

    EXIT.

    ENDIF.

    START-OF-SELECTION.

    IF flag = 'X'.

    WRITE / 'No input for CARRID'.

    EXIT.

    ENDIF.

    GET spfli.

    GET sflight.

    GET sbook.

    END-OF-SELECTION.

    WRITE / 'End of Selection'.

    If the user does not enter a value for CARRID-LOW, the output appears as follows:

    No selection made for CARRID

    After the first EXIT statement, the next START-OF-SELECTION event is triggered. After the second EXITstatement, the output list is displayed.

    to be reward all helpfull answers,

    Regards.

    Jay

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.