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

and/or condition

Former Member
0 Likes
553

Hi....i want to have if else condition like....in which i am comparing 2 fields kmein and kpein like

if ( ( ITAB-KMEIN NE ITAB-KMEIN1 ) AND ( ITAB-KPEIN NE ITAB-KPEIN1 )).

itab-UOMC = 'Y'.

else.

if (( itab-kpein NE itab-kpein1 ) OR ( itab-kpein NE itab-kpein1 )).

itab-UOMC = 'Y'.

endif.

but it is logically wrong.

do let me know where i am making the mistakes.

i wish to have if condition working for either and/or condition.

please guide

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
533

Hi ,

Try this....

IF ITAB-KMEIN NE ITAB-KMEIN1

AND ITAB-KPEIN NE ITAB-KPEIN1.

itab-UOMC = 'Y'.

ELSEIF itab-kpein NE itab-kpein1 OR itab-kpein NE itab-kpein1 .

itab-UOMC = 'Y'.

ENDIF.

Hi....i want to have if else condition like....in which i am comparing 2 fields kmein and kpein like

if ( ( ITAB-KMEIN NE ITAB-KMEIN1 ) AND ( ITAB-KPEIN NE ITAB-KPEIN1 )).

itab-UOMC = 'Y'.

else.

if (( itab-kpein NE itab-kpein1 ) OR ( itab-kpein NE itab-kpein1 )).

itab-UOMC = 'Y'.

endif.

but it is logically wrong.

do let me know where i am making the mistakes.

i wish to have if condition working for either and/or condition.

please guide

2 REPLIES 2
Read only

Former Member
0 Likes
533

Hi,

if ( ( ITAB-KMEIN NE ITAB-KMEIN1 ) AND ( ITAB-KPEIN NE ITAB-KPEIN1 )).

itab-UOMC = 'Y'.

elseIf (( ITAB-KMEIN NE ITAB-KMEIN1) OR ( itab-kpein NE itab-kpein1 )).

itab-UOMC = 'Y'.

endif.

or

if ( ( ITAB-KMEIN NE ITAB-KMEIN1 ) AND ( ITAB-KPEIN NE ITAB-KPEIN1 )) OR

( ( ITAB-KMEIN NE ITAB-KMEIN1 ) OR ( itab-kpein NE itab-kpein1 )).

itab-UOMC = 'Y'.

ENDIF.

Read only

Former Member
0 Likes
534

Hi ,

Try this....

IF ITAB-KMEIN NE ITAB-KMEIN1

AND ITAB-KPEIN NE ITAB-KPEIN1.

itab-UOMC = 'Y'.

ELSEIF itab-kpein NE itab-kpein1 OR itab-kpein NE itab-kpein1 .

itab-UOMC = 'Y'.

ENDIF.