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

condition fails

Former Member
0 Likes
1,713

Hi ,

i have written below code.

am doing some calculations and am getting value into variable  wa_final-a1 = 0.25.

IF wa_final-a1 IS NOT INITIAL AND wa_final-a1 NE 0.


endif.


Even though the condition is true but the cursor is not going inside.


Please somebody help on this.



Regards,

Naveen Bathula.

Hi ,

i have written below code.

am doing some calculations and am getting value into variable  wa_final-a1 = 0.25.

IF wa_final-a1 IS NOT INITIAL AND wa_final-a1 NE 0.


endif.


Even though the condition is true but the cursor is not going inside.


Please somebody help on this.



Regards,

Naveen Bathula.

7 REPLIES 7
Read only

former_member196331
Active Contributor
0 Likes
1,680

i hope Not

IF wa_final-a1 IS NOT INITIAL AND wa_final-a1 NE 0.


endif.


Like

IF wa_final-a1 IS NOT INITIAL or wa_final-a1 NE 0.


endif.


And means it is checking both , if both satisfies then only going inside.

Or means  either anyone satisfies then only it will go inside.


Read only

0 Likes
1,680

Hi ,

1.why do you need both conditions? any one is enough

Try replacing NE with '<>'.

2. what is the data type of wa_final-a1.?

Read only

raghug
Active Contributor
0 Likes
1,680

Did you declare wa_final-a1 as an integer or some other type without decimals?

Read only

Former Member
0 Likes
1,680

it is of string why am using because in if condition am using division operation .

Read only

Former Member
0 Likes
1,680

Hi naveen,

You code is correct. I think your data type would be wrong. Please assign packed decimal or currency data type for your variable a1.

Read only

ashraf_usmani
Participant
0 Likes
1,680

Hello

And works for both true condition. so wa_final-a1 will be either NULL or 0 cannot be both at the same time

Please try Below code

IF Not wa_final-a1 IS INITIAL


Code A


ELSEIF wa_final-a1 NE '0'.


Code B


ELSE.


Code C


ENDIF.


Regards

Ashraf Usmani


Read only

Former Member
0 Likes
1,680

This message was moderated.