‎2008 Jul 08 12:29 PM
Hi
Based on the condition, how to block the execution of the statement following the condition
Cheers
Christina
‎2008 Jul 08 12:33 PM
hi,
You can try like this.
Exiting a Loop
To terminate an entire loop immediately and unconditionally, use the EXIT statement in the statement block of the loop.
After this statement, the loop is terminated, and processing resumes after the closing statement of the loop structure (ENDDO, ENDWHILE, ENDLOOP, ENDSELECT). In nested loops, only the current loop is terminated.
DO 4 TIMES.
IF SY-INDEX = 3.
EXIT.
ENDIF.
WRITE SY-INDEX.
ENDDO.
The output is:
1 2
In the third loop pass, the loop is terminated before the WRITE statement is processed.
regards,
Veeresh
‎2008 Jul 08 12:31 PM
Hi,
Use CHECK statement.
For more details check this link:
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9afe35c111d1829f0000e829fbfe/content.htm
Regards
Adil
‎2008 Jul 08 12:33 PM
hi,
You can try like this.
Exiting a Loop
To terminate an entire loop immediately and unconditionally, use the EXIT statement in the statement block of the loop.
After this statement, the loop is terminated, and processing resumes after the closing statement of the loop structure (ENDDO, ENDWHILE, ENDLOOP, ENDSELECT). In nested loops, only the current loop is terminated.
DO 4 TIMES.
IF SY-INDEX = 3.
EXIT.
ENDIF.
WRITE SY-INDEX.
ENDDO.
The output is:
1 2
In the third loop pass, the loop is terminated before the WRITE statement is processed.
regards,
Veeresh
‎2008 Jul 08 12:33 PM
hi,
Use Check statement ...
check v_value ne 0.Refer
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/check.htm
‎2008 Jul 08 12:33 PM
Hi,
If ur in a loop u can exit from the loop.
else u can use IF or CHECK conditions.
Anju
‎2008 Jul 08 12:33 PM
Simply use the if endif statement..
if <Condition>.
statement.
endif.
‎2008 Jul 08 12:33 PM
Hi,
You can Use EXIT or STOP Satement To Execute The Next statement to be Executed.
In Case of EXIT it does not trigger END-OF-SELECTION.
But in case of STOP It do that display the Output before STOP.
Regards,
Sujit
‎2008 Jul 08 12:35 PM
Hi,
We have commands like EXIT, CHECK, STOP,CONTINUE to control the flow of the execution.
Please read the help for the above conditions and use according to your requirement.
‎2008 Jul 08 12:35 PM
Hi Christina,
U can check the condition with IF Condition and depending on the condition u can use EXIT to block the execution of the ststements.
or
You can use CHECK statement.
Best regards,
raam
‎2008 Jul 08 12:36 PM
Hi
Try using TRY Block,CATCH Block,CLEANUP Block. In this you can catch the exception which need not be executed and catch it using CATCH BLOCK and for prevent it from being executed use CLEAN UP BLOCK.
Regards
Divya
‎2008 Jul 08 12:38 PM
Hello
1. If condition is simple, use check.
ex: check sy-subrc = 0.
2. If condition is complex, use exit.
ex:
if cond1 > 0 and cond2 > 0 and cond3 > 0.
exit.
endif.