Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

QUERY DIFF BETWEEN CHECK AND IF

Former Member
0 Likes
693

Hi all,

what is the difference between check and if.

Which one is advisable to use in dialog program for field statment

Thanks

PREETI

5 REPLIES 5
Read only

Former Member
0 Likes
661

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

Read only

Former Member
0 Likes
661

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

Read only

Former Member
0 Likes
661

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

Read only

andrea_galluccio2
Contributor
0 Likes
661

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

Read only

Former Member
0 Likes
661

Hi,

use of if and check in dialog depends upon your

flow logic.

Regards

amole