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

IF QUERY is giving error

Former Member
0 Likes
587

Hi,

The following IF QUERY is giving error.

when the value for WA-ITNO = M23 then the flag is set to X.

when the value of WA-ITNO = O20 then the flag should be initial.But when I am checking the code even with O20 it sets the flag as X.it does not go to the ELSEIF part of the code.

IF ( WA-ITNO >= 'M01' OR WA-ITNO <= 'M99' ).

WA_FINAL-FLAG = 'X'.

ELSEIF ( WA-ITNO >= 'O01' OR WA-ITNO <= 'O99' ).

WA_FINAL-FLAG = ''.

ENDIF.

Please advice

Thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
556

Hello

Replace OR on AND in IF condition.

Hi,

The following IF QUERY is giving error.

when the value for WA-ITNO = M23 then the flag is set to X.

when the value of WA-ITNO = O20 then the flag should be initial.But when I am checking the code even with O20 it sets the flag as X.it does not go to the ELSEIF part of the code.

IF ( WA-ITNO >= 'M01' OR WA-ITNO <= 'M99' ).

WA_FINAL-FLAG = 'X'.

ELSEIF ( WA-ITNO >= 'O01' OR WA-ITNO <= 'O99' ).

WA_FINAL-FLAG = ''.

ENDIF.

Please advice

Thanks.

3 REPLIES 3
Read only

Former Member
0 Likes
557

Hello

Replace OR on AND in IF condition.

Read only

Former Member
0 Likes
556

Hi,

What is the data type for the field WA-ITNO ?

Also try changing the OR to AND


IF ( WA-ITNO >= 'M01' AND  WA-ITNO <= 'M99' ).
WA_FINAL-FLAG = 'X'.

ELSEIF ( WA-ITNO >= 'O01' AND WA-ITNO <= 'O99' ).
clear: WA_FINAL-FLAG.         " use this instead
ENDIF.

Vikranth

Read only

Former Member
0 Likes
556

SOLVED