2008 Feb 11 9:31 AM
When I use EXIT command in subroutine its comming out of subroutine, but according to my requit=rement it has to come out of the program,
how can this be done.
When I use EXIT command in subroutine its comming out of subroutine, but according to my requit=rement it has to come out of the program,
how can this be done.
2008 Feb 11 9:36 AM
2008 Feb 11 9:40 AM
2008 Feb 11 9:43 AM
Hi,
You can use any of the following statements :
STOP
LEAVE PROGRAM
LEAVE TO selection-screen.
LEAVE TO SCREEN 0.
Thanks,
Sriram Ponna.
2008 Feb 11 9:47 AM
hi
exit----if it is in the loop comes out of the loop.
-
if it is in the subroutine comes out of the routine.
-
if it is in the program comes out of the program.
use stop.
2008 Feb 11 9:50 AM
Hi
Properties of 'Exit'
1- If used inside loop, it will end loop processing and come out of loop.
2- If used outside the loop, it leaves current processing block.
So to come out of program, set a flag inside the subroutine and then exit from that subroutine. Just after that subroutine call. Check that flag using 'if' and then again call 'exit'. This time it will leave the processing completely.
Check code below:
REPORT ytest_swet2.
data : gv_flag type c.
START-OF-SELECTION.
PERFORM rms.
break-point.
IF gv_flag = 'x'.
*The control will leave the program
EXIT.
ENDIF.
PERFORM sms.
&----
*& Form rms
&----
FORM rms .
*
Above write other code
When need to leave program update the flag and come out
gv_flag = 'x'.
EXIT.
ENDFORM. " rms
&----
*& Form sms
&----
FORM sms .
WRITE : 'sms'.
ENDFORM. " sms
First of all subroutine rms is called. The control comes out of the subroutine and the flag gv_flag is set to x. Further again we are checking the flag and exiting the program.
Also we can call 'Leave program' to directly come out of program in this case.
2008 Feb 11 10:07 AM
Hi
good
I would suggest you to debug the report properly and place the exit statement at the right place.
thanks
mrutyun^
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |