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

NOT in Operator

Former Member
0 Likes
699

Hello Experts,

Plz tell where i m wrong in my code.

if ( record-EKORG_002 NOT IN ('1000','1100' ,'1200' ) ).

move-corresponding record to it_error.

append it_error.

OR

if ( record-bukrs_001 cs 'XYZ' ).

if ( ( record-ekorg_002 ne '1000' ) or ( record-ekorg_002 ne '1100' )

or ( record-ekorg_002 ne '1200' ) ).

move-corresponding record to it_error.

append it_error.

endif.

endif.

Hello Experts,

Plz tell where i m wrong in my code.

if ( record-EKORG_002 NOT IN ('1000','1100' ,'1200' ) ).

move-corresponding record to it_error.

append it_error.

OR

if ( record-bukrs_001 cs 'XYZ' ).

if ( ( record-ekorg_002 ne '1000' ) or ( record-ekorg_002 ne '1100' )

or ( record-ekorg_002 ne '1200' ) ).

move-corresponding record to it_error.

append it_error.

endif.

endif.

4 REPLIES 4
Read only

Former Member
0 Likes
649

Hi,

Try this.

If u r using the second stmt, then try like this

if ( record-bukrs_001 cs 'XYZ' ).

if ( ( record-ekorg_002 ne '1000' ) AND

( record-ekorg_002 ne '1100' ) AND

( record-ekorg_002 ne '1200' ) ).

move-corresponding record to it_error.

append it_error.

endif.

endif.

Sharin

Read only

Former Member
0 Likes
649

Hi,

chnage your below code as

if ( record-bukrs_001 cs 'XYZ' ).

if ( ( record-ekorg_002 ne '1000' ) and ( record-ekorg_002 ne '1100' )

and ( record-ekorg_002 ne '1200' ) ).

move-corresponding record to it_error.

append it_error.

endif.

endif.

Regards,

Paliwal

Read only

Former Member
0 Likes
649

hi,

>

> if ( record-bukrs_001 cs 'XYZ' ).

>

> if ( ( record-ekorg_002 ne '1000' ) or ( record-ekorg_002 ne '1100' )

> or ( record-ekorg_002 ne '1200' ) ).

> move-corresponding record to it_error.

> append it_error.

>

>

> endif.

> endif.

in place of OR use AND in the second IF statement.

thus your statement will look like following.


if ( ( record-ekorg_002 ne '1000' ) AND
  ( record-ekorg_002 ne '1100' ) AND
  ( record-ekorg_002 ne '1200' ) ).

Read only

Neslinn
Participant
0 Likes
649

Hi ,

U have to use AND instead of OR condition as it is a NE operation. If you are gng for a EQ condition u can use the or condition.

Regards, Neslin.