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

When will the IF condition trigger...

aris_hidalgo
Contributor
0 Likes
701

Hello Experts,

Can you please explain on when will this IF condition take effect? Thank you guys and take care!

IF wa_vbrp-fklmg NE 0 OR ( ( wa_vbak-auart EQ c_auart_zuci OR wa_vbak-auart EQ c_auart_zurv )

AND wa_mseg-menge NE 0 ).

ENDIF

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
667

hi,

in your if condition u have used two logical operators.

1. or

2. and

or is some thing like this if any one of the conditions are correct then if is executed

and 'AND' is if both conditions are correct only then if is executed.

i.e wa_vbrp-fklmg NE or

( wa_vbak-auart EQ c_auart_zuci OR wa_vbak-auart EQ c_auart_zurv ) in this any one

conditions is correct then its enough for execution and it will check or another condition

wa_mseg-menge NE 0 -it must be true. then if the outer condition isfalse then if condition is executed or else part is executed.

and also if outer condition wa_vbrp-fklmg NE is true then it won't go to another condition and it will directly executes the if condition.

if helpful reward some points.

with regards,

Suresh Babu Aluri.

7 REPLIES 7
Read only

Former Member
0 Likes
667

there are 3 cdn's

1. wa_vbrp-fklmg NE 0

2. OR wa_vbak-auart EQ c_auart_zuci OR wa_vbak-auart EQ c_auart_zurv

3. AND wa_mseg-menge NE 0 ).

Read only

alejandro_bindi
Active Contributor
0 Likes
667

Hi,

Indented code will always help you understand this things better:


IF wa_vbrp-fklmg NE 0 OR
   ( ( wa_vbak-auart EQ c_auart_zuci OR
       wa_vbak-auart EQ c_auart_zurv )
     AND wa_mseg-menge NE 0 ).

	[Conditions true = execute code inside IF]
ENDIF 

Code will execute when:

a) fklmg is not zero

b) fklmg is zero, and auart is equal either to c_auart_zuci or c_auart_zurv, and menge is not zero.

(mentioning only field name in the sake of simplicity).

Regards.

Please reward points if helpful.

Read only

Former Member
0 Likes
667

hi,

the if condition will trigger when either of following or both is true

1. wa_vbrp-fklmg NE 0

2. either wa_vbak-auart EQ c_auart_zuci OR wa_vbak-auart EQ c_auart_zurv

and

wa_mseg-menge NE 0

hope that helps

Read only

Former Member
0 Likes
667

Hi,

It will be executed when:

1. wa_vbrp-fklmg NE 0

2. wa_vbak-auart EQ c_auart_zuci AND wa_mseg-menge NE 0

3. wa_vbak-auart EQ c_auart_zurv AND wa_mseg-menge NE 0

Read only

Former Member
0 Likes
668

hi,

in your if condition u have used two logical operators.

1. or

2. and

or is some thing like this if any one of the conditions are correct then if is executed

and 'AND' is if both conditions are correct only then if is executed.

i.e wa_vbrp-fklmg NE or

( wa_vbak-auart EQ c_auart_zuci OR wa_vbak-auart EQ c_auart_zurv ) in this any one

conditions is correct then its enough for execution and it will check or another condition

wa_mseg-menge NE 0 -it must be true. then if the outer condition isfalse then if condition is executed or else part is executed.

and also if outer condition wa_vbrp-fklmg NE is true then it won't go to another condition and it will directly executes the if condition.

if helpful reward some points.

with regards,

Suresh Babu Aluri.

Read only

Former Member
0 Likes
667

this if condition will effect based two coditions if either one of given below satisfy.

1. when <b>wa_vbrp-fklmg NE 0</b> - the if statement executes.

2. when <b>wa_vbak-auart</b> is equal to(<b>EQ</b>) either c<b>_auart_zuci </b> or

<b>c_auart_zurv </b>

and <b>wa_mseg-menge </b> not eual to(<b>NE</b>) <b>0</b> .

regards

Vijaykumar Reddy. S

Read only

Former Member
0 Likes
667

Hai Viray,

It will execute the conditions in the following manner:

1. wa_vbak-auart EQ c_auart_zuci OR wa_vbak-auart EQ c_auart_zurv

Anyone of the condition has to be satisfied

2. wa_mseg-menge NE 0

The above conditon mingles with the present one

3. wa_vbrp-fklmg NE 0

It will give the value by satisfying any one of the condition( 2 or 3)

Gokul.N