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 condition

Former Member
0 Likes
522

Hi ,

This is my if condition....

IF NOT xvbap-posnr IS INITIAL.

<b>IF ( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ) AND

( yvbap-pstyv = 'ZROR' OR yvbap-pstyv = 'ZROW' ).

MESSAGE e901 WITH text-005.

ELSEIF ( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ) AND

( xvbap-pstyv is intial ).

MESSAGE e901 WITH text-005.

  • endif.

ENDIF.</b>

ENDIF.

can some one tell me how to combine the inner If- Elseif condition into a single if condition using OR.

i.e. IF ( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ) AND

( yvbap-pstyv = 'ZROR' OR yvbap-pstyv = 'ZROW' ) OR

( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ) AND

( xvbap-pstyv is initial ).

MESSAGE e901 WITH text-005.

endif.

the statement should have the same functionaity like the above (in bold)..

Thank You,

Challa.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
485
IF ( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ) AND
( yvbap-pstyv = 'ZROR' OR yvbap-pstyv = 'ZROW'  OR xvbap-pstyv is INITIAL).

MESSAGE e901 WITH text-005.

ENDIF.

Regards

Aneesh.

3 REPLIES 3
Read only

Former Member
0 Likes
486
IF ( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ) AND
( yvbap-pstyv = 'ZROR' OR yvbap-pstyv = 'ZROW'  OR xvbap-pstyv is INITIAL).

MESSAGE e901 WITH text-005.

ENDIF.

Regards

Aneesh.

Read only

Former Member
0 Likes
485

Check this below.

IF NOT xvbap-posnr IS INITIAL and

( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ).

IF ( yvbap-pstyv = 'ZROR' OR yvbap-pstyv = 'ZROW' ).

MESSAGE e901 WITH text-005.

ELSE xvbap-pstyv is intial.

MESSAGE e901 WITH text-005.

ENDIF.

ENDIF.

<b><REMOVED BY MODERATOR></b>

Thanks,

Srinivas

Message was edited by:

Alvaro Tejada Galindo

Read only

former_member195698
Active Contributor
0 Likes
485

Hi,

Your second condition will never be true..

ELSEIF ( xvbap-pstyv = 'ZIRO' OR xvbap-pstyv = 'ZIRW' ) AND

( xvbap-pstyv is intial ).

There are two cases

1) IF XVBAP-PSTYV is initial -- In this case the First Condition before AND Will fail and second condition after AND will be TRUE. Net result is FALSE.

2) IF XVBAP-PSTYV is filled --- In this case the SECOND condition AFTER AND will Fail. First condition might or might not be true depending on the value of the field. Net Result is FALSE.

Regards,

Abhishek