Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ABAP syntax error?

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
0
0
US
Hi, I'm trying to modify an ABAP that someone else wrote (I know nothing about SAP or ABAPs...) but I'm getting a syntax error. I want to check if a specific bit is turned on by ANDing a value with a mask, but SAP tells me that the BIT-AND operator is not allowed. How can I change this to make it work?
Code:
FUNCTION zrfc_user_enable_status.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(USERNAME) LIKE  BAPIBNAME-BAPIBNAME
*"  TABLES
*"      RETURN STRUCTURE  BAPIRET2
*"----------------------------------------------------------------------

*"----------------------------------------------------------------------
* tables used for fetching the status of an user
  TABLES: usr02.
*"----------------------------------------------------------------------
*"----------------------------------------------------------------------
  DATA : BEGIN OF zreturn .
          INCLUDE STRUCTURE bapiret2.
  DATA : END OF zreturn.
*"----------------------------------------------------------------------
* Fetch record from system table USR02. This table is used to store User
* data

  TRANSLATE username TO UPPER CASE.

  SELECT SINGLE * FROM usr02 WHERE bname = username.
*"----------------------------------------------------------------------
* system variable return value '0' if record is available.
* returns '4' if record does not exist.
*"----------------------------------------------------------------------

  IF sy-subrc = 0.
*"----------------------------------------------------------------------
* value '0' is stored, if input user is in enable state
*"----------------------------------------------------------------------
    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 ( usr02-uflag [b][COLOR=red]BIT-AND[/color][/b] '64' ) = '64'.
      zreturn-number = '777'.
      zreturn-message = 'USER IS LOCKED BY ADMINISTRATOR'.
      APPEND zreturn TO return.
      CLEAR zreturn.

*      MOVE '777' TO return-number.
*      MOVE 'USER IS LOCKED BY ADMINISTRATOR' TO return-message.
*      APPEND return.
*      CLEAR return.
*"----------------------------------------------------------------------
* value '128' is stored, if input user is in lock state done by other
* user.
*"----------------------------------------------------------------------
    ELSEIF ( usr02-uflag [b][COLOR=red]BIT-AND[/color][/b] '128' ) = '128'.

      zreturn-number = '666'.
      zreturn-message = 'USER IS LOCKED BY OTHER USER'.
      APPEND zreturn TO return.
      CLEAR zreturn.

*      MOVE '666' TO return-number.
*      MOVE 'USER IS LOCKED BY OTHER USER' TO return-message.
*      APPEND return.
*      CLEAR return.
    ENDIF.
  ELSE.
*"----------------------------------------------------------------------
* value '211' is returned to export structure, if does not exist
*"----------------------------------------------------------------------
      zreturn-number = '211'.
      zreturn-message = 'USER DOES NOT EXISTS'.
      APPEND zreturn TO return.
      CLEAR zreturn.
*
*    MOVE '211' TO return-number.
*    MOVE 'USER DOES NOT EXISTS' TO return-message.
*    APPEND return.
*    CLEAR return.
  ENDIF.
ENDFUNCTION.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top