Skip to Content
author's profile photo Former Member
Former Member

IF/OR Statement Question?

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'.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2007 at 06:48 PM

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

    Use AND Operator and should work.

    ashish

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2007 at 06:54 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2007 at 06:57 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.