‎2006 Oct 12 2:32 PM
Hi all,
what is the difference between check and if.
Which one is advisable to use in dialog program for field statment
Thanks
PREETI
‎2006 Oct 12 2:35 PM
Hi Preeti,
Check out the description: Hope it clarifies:
<b>Define "Check " statements, how it works?</b>
To terminate a single loop pass conditionally, use the CHECK <condition> statement in the statement block of the loop.
If the condition is not true, any remaining statements in the current statement block after the CHECK statement are ignored, and the next loop pass starts. <condition> can be any logical expression.
Reward points if it helps.
Manish
‎2006 Oct 12 2:39 PM
Hi,
check matnr in s_matnr
write 'test'.
executes code
after check only when condition satisfies
if matnr in s_matnr.
endif.
write 'test'.
executes code below if condition even if condition
doesn't satisfy.
Regards
amole
‎2006 Oct 12 2:40 PM
start of processing block.
if <b>not</b> condition.
exit.
endif.
*some more statements
end of processing block.
is equivalent to
start of processing block.
check condition.
*some more statements
end of processing block.
Check is more readable.
Performance wise, avoid check statements.
Regards,
ravi
‎2006 Oct 12 2:41 PM
Hi,
they work in different ways.
IF..ENDIF.
If u use "if .. endif" the program continues after the endif, and execute the code bewteen if and endif is the condition is fulfilled.
CHECK
If u use check, and if the condition is not fullfill, all the lines after the instructions will not be executed.
With check instruction, un can exit from a form before the end of it.
For example :
form use_check using value.
if value gt 0.
value = value * 100.
endif.
endform.
in this case u could use check.
form use_check using value.
check value gt 0.
value = value * 100.
endform.
When use one instead of the other? depends on wich u have to do.
Hope it helps
Andrea
Pls reward if it helps
‎2006 Oct 12 2:41 PM
Hi,
use of if and check in dialog depends upon your
flow logic.
Regards
amole