05-11-2007 1:01 PM
plz tell me the difference between exit and stop when used in different situations like inside loop,i the program etc.
05-11-2007 2: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
05-11-2007 1:03 PM
check these links
http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9ad735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9ad735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9ad735c111d1829f0000e829fbfe/content.htm
Message was edited by:
Rajesh
05-11-2007 1: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
05-11-2007 1: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.
05-11-2007 1: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
05-11-2007 1: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.
05-11-2007 2: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
05-11-2007 2: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
05-11-2007 8: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.
11-30-2007 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
11-30-2007 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