Skip to Content
0
Former Member
Apr 09, 2007 at 08:36 PM

Bitwise AND isn't working for me...

42 Views

Hi,

I'm trying to do something that would be extremely easy for me in a language like C or C++, but since I know nothing about SAP or ABAP except what I've read in the past few days, this problem is a little harder than I had hoped.

I have some ABAP code written by someone else long ago, which I need to fix. Here is the part of the code that I'm trying to modify:

IF usr02-uflag = 0.
      zreturn-number = '245'.
      zreturn-message = 'USER IS IN ENABLE STATE'.
      APPEND zreturn TO return.
      CLEAR zreturn.

*"----------------------------------------------------------------------
* value '64' is stored, if input user is in lock state done by
* adminstrator
*"----------------------------------------------------------------------
    ELSEIF <b>usr02-uflag = '64'.</b>
      zreturn-number = '777'.
      zreturn-message = 'USER IS LOCKED BY ADMINISTRATOR'.
      APPEND zreturn TO return.
      CLEAR zreturn.

I want to change the comparison <b>usr02-uflag = '64'.</b> so that it AND's the value with 64 so I can see if that particular bit flag is turned on.

I haven't been able to find any type declaration for usr02 yet, but I'm assuming usr02-uflag is some kind of string or xstring...?

I tried converting the string to a hex number and using the BIT-AND operator, but I didn't get the correct value when I did that.

Can someone please show me the quickest/easiest way to do the following (pseudo-code of course):

ELSEIF ( usr02-uflag BIT-AND 64 ) = 64.