‎2007 Apr 18 6:15 AM
Hi Friends,
Any one Explain Exit Statement with Example
Regards,
Maya
‎2007 Apr 18 6:17 AM
hi,
Exit statement means coming out of a loop when ever certain conditon sastisfies
do.
count = count + 1.
if count = '5'.
EXIT.
endif.
enddo.Refer this to understand better
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/exit_.htm
Regards,
Santosh
‎2007 Apr 18 6:18 AM
Hi Maya,
EXIT statement is the control break statement. If you put this statement in the loop then the control will come our of the loop and excute the next statement after the Endloop.
If this statement in Subroutine then it will come out of the the routine and exxcute the next statement of the perform statement.
If this statement in if condition then it will comeout of that Event .
I think this will understand you clearly
Warm Regards,
Vijay
‎2007 Apr 18 6:19 AM
Hi,
Exit can be used to get out of loops like Do, Loop, While and
Select Endselect, for a particular condition.
Thanks
Sandeep
Reward if helpful
‎2007 Apr 18 6:20 AM
‎2007 Apr 18 6:20 AM
Hi Maya,
The <b>exit</b> statement prevents further processing from occurring.
Syntax for the exit Statement
exit.
Sample Program
Using EXIT to Stop Program Processing Dead in Its Tracks
1 report ztx1006.
2 write: / 'Hi'.
3 exit.
4 write: / 'There'.
The code produces this output:
Hi
Exit prevents further processing, so the exit on line 3 prevents line 4 from being executed.
exit can be used in many situations. It can have varying effects depending on where it appears in the code. However, it always prevents further processing. Within loop structures, it leaves loop processing introduced by statements such as loop, select, do, and while. Within subroutines, it leaves subroutines introduced by FORM. Its effects in other situations will be fully explored as they arise.
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 18 6:28 AM
Hi MAYA,
If u use the exit statement in loop.
To terminate the loop entirely without any condition.
Syntax:
Do 4 times.
If sy-index = 3.
Exit.
Endif.
Write sy-index.
Enddo.
The syatem terminate s the entire loop processing.
Rewords some points,
Rgds,
P.Nag