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/OR Statement Question?

Former Member
0 Likes
419

How do I say the following in one IF stmt?

if i_ekko-bsart NE 'AB' .

if i_ekko-bsart NE 'AN'.

endif.

endif.

I've tried the following but logic doesn't seem to work the same? Thanks.

if ( i_ekko-bsart NE 'AB' ) or ( i_ekko-bsart NE 'AN' ).

if ( i_ekko-bsart NE 'AB' or i_ekko-bsart NE 'AN' ).

if i_ekko-bsart NE 'AB' or i_ekko-bsart NE 'AN'.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
384

if i_ekko-bsart NE 'AB' AND i_ekko-bsart NE 'AN'.

Use AND Operator and should work.

ashish

3 REPLIES 3
Read only

Former Member
0 Likes
385

if i_ekko-bsart NE 'AB' AND i_ekko-bsart NE 'AN'.

Use AND Operator and should work.

ashish

Read only

Former Member
0 Likes
384

Hi,

You could define a range for BSART.

r_bsart-sign = 'I'.
r_bsart-option = 'EQ'.
r_bsart-low = 'AB'.
append r_bsart.
r_bsart-low = 'AN'.
append r_bsart.

IF i_ekko-bsart NOT IN r_bsart.

ENDIF.

Sri

Read only

Former Member
0 Likes
384

Hi

Simple thing

when it is EQ parameter you use OR

when it is NE then use AND

so here use

if ( i_ekko-bsart NE 'AB' AND i_ekko-bsart NE 'AN' ).

.......................................

endif.

in other cases when it is EQ

if ( i_ekko-bsart EQ 'AB' OR i_ekko-bsart EQ 'AN' ).

.......................................

endif.

Regards

Anji