‎2007 Jun 14 10:48 AM
what is the significance of at exit command where we will use it
‎2007 Jun 14 10:53 AM
Hi,
The exit command is mostly used in subroutines.If in a subroutine you have a condition such that if it is not satisfied then you must come out of the subroutine,then you have to use the EXIT command.
If the exit command is used,it will stop the execution of the subroutine and come out of it.If you have some more subroutines then their execution will take place.
Thanks,
Sandeep.
‎2007 Jun 14 10:50 AM
Hi,
EXIT command is used to terminate the loop.
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.
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/exit.htm
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
Regards,
Priyanka.
Message was edited by:
Priyanka Neelam
‎2007 Jun 14 10:53 AM
Hi,
The exit command is mostly used in subroutines.If in a subroutine you have a condition such that if it is not satisfied then you must come out of the subroutine,then you have to use the EXIT command.
If the exit command is used,it will stop the execution of the subroutine and come out of it.If you have some more subroutines then their execution will take place.
Thanks,
Sandeep.
‎2007 Jun 14 10:59 AM
Hi,
suppose if u want to exit from a loop when a perticular condition is reached u have to use exit command.
see this example.
do 5 times.
if sy-index = 3.
exit.
endif.
write:/ sy-index.
enddo.
the output of this is :1 2
please assign points & close all the threads if u got the solution.
rgds,
bharat.,
‎2007 Jun 14 11:01 AM
hi
good
When the user chooses a function with type E, the screen flow logic jumps directly to the following statement:
MODULE <mod> AT EXIT-COMMAND.
Regardless of where it occurs in the screen flow logic, this statement is executed immediately, and before the automatic checks for the field contents on the screen. Before the module <mod> is executed, the contents of the OK-CODE field are transported to the ABAP field with the same name. However, no other screen fields are transported to the program at this stage. If you have more than one MODULE statement with the AT EXIT-COMMAND addition, only the first is executed. If there are no MODULE statements with the AT EXIT-COMMAND statement, normal PAI processing resumes.
If the user chooses a function whose function code does not have type E, the MODULE <mod> AT EXIT-COMMAND statement is not executed.
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaa9535c111d1829f0000e829fbfe/content.htm
thanks
mrutyun^
‎2007 Jun 15 9:49 AM