Application Development 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: 

IF/OR Statement Question?

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Use AND Operator and should work.

ashish

3 REPLIES 3

Former Member
0 Kudos

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

Use AND Operator and should work.

ashish

Former Member
0 Kudos

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

Former Member
0 Kudos

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