Skip to Content
avatar image
Former Member

Want to put a condition based on IF Statement.

Hi.

I have a situation in which there is a specific code which I want to skip if say sales organisation is 'A' or 'B' or 'C' or 'D'.

and if I write

if sales org ne 'A'

OR sales org ne 'B'

OR sales org ne 'C'

OR sales org ne 'D'

then only perform my coding.

This kind of logic doesnt work.

Please tell me how shall I proceed?

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    May 04, 2006 at 09:00 AM

    Hi subhash,

    1. do not write like this.

    2. use like this.

    (just copy paste)

    3.

    report abc.

    PARAMETERS : P TYPE C.

    IF NOT ( P = 'A' OR P = 'B' OR P = 'C' OR P = 'D' ).

    WRITE :/ 'OK'.

    ELSE.

    WRITE :/ 'NOT OK'.

    ENDIF.

    regards,

    amit m.

    Add comment
    10|10000 characters needed characters exceeded

  • May 04, 2006 at 09:01 AM

    use the below logic..

    IF SALESORG EQ 'A' OR

    SALESORG EQ 'B' OR

    SALESORG EQ 'C' OR

    SALESORG EQ 'D'.

    CONTINUE.

    <Ur code for validations...>

    ENDIF.

    Cheers,

    abdul

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 04, 2006 at 09:03 AM

    hi,

    write as

    IF ( sales org <> 'A' )

    OR ( sales org <> 'B' )

    OR ( sales org <> 'C' )

    OR ( sales org <> 'D' ).

    -


    -


    ENDIF.

    HOPE THIS HELPS,

    PRIYA.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 04, 2006 at 09:07 AM

    Hi Subhash,

    you can use <i>case statement</i>

    case sales_org.

    when 'A' or 'B' or 'C' or 'D'.

    do anything skipping the code.

    when others.

    specify code here.

    endcase.

    regards,

    Kinshuk

    Add comment
    10|10000 characters needed characters exceeded

  • May 04, 2006 at 09:07 AM

    YOu can also do this way:

    if not sales_org in ( 'A', 'B', 'C', 'D' ).

    *do something.

    endif.

    Regards,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 04, 2006 at 09:19 AM

    Hey Subhash,

    Try this logic :

    <b>Case <sales_org> .

    When 'A'.

    When 'B'.

    When 'C'.

    When 'D'.

    When Others .

    • do that specific code.

    Endcase.</b>

    Sample code to prove this point :

    data sales_org type c value 'F'.

    Case sales_org .

    When 'A'.

    When 'B'.

    When 'C'.

    When 'D'.

    When Others .

    write : sales_org.

    endcase.

    Regards,

    Kunal.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 04, 2006 at 09:33 AM

    Hai Subash

    report Zxyz.

    PARAMETERS : P_sal TYPE C.

    IF P_sal NOT in ( 'A' , 'B' ,'C' ,'D' ).

    WRITE :/ 'OK'.

    ELSE.

    WRITE :/ 'NOT OK'.

    ENDIF.

    Thanks & regards

    Sreenivasulu P

    Add comment
    10|10000 characters needed characters exceeded