Uflag Sap

broken image


Sap

When we don't have any user to login into SAP ABAP level to unlock sap* and ddic user ,Mostly it requires in client 000 as it is supported by SAP BASIS Team . In this case we can unlock sap* or ddic user from OS level / Databse / Sql Level

Unlock DDIC User from OS Level / database /SQL /Oracle level:

Unlock SAP. on DB2. Execute the following command. UPDATE SAPSCHEMA.USR02 set UFLAG=0 where BNAME='SAP.' and MANDT='000' Reset / Delete SAP. on DB2. Execute the following command. DELETE SAPSCHEMA.USR02 where BNAME='SAP.'and MANDT='000' Note. SAPSCHEMA is the database schema. MANDT is the client number. If we can reach the SAP system from database via SQLPLUS tool then we can lock or unlock any SAP users without the SAPGUI. Let's look a little bit closer with some examples; First of all we need to know UFLAG variable. 0 User status is UNLOCK, can logon to SAP system. 32 User status is LOCK with GLOBAL, from Administrator, cannot logon to SAP system.

Login into Sqlplus:

sqlplus / as sysdba

SQL> select MANDT, BNAME, UFLAG from .USR02 where MANDT= and BNAME='DDIC';

MAN BNAME UFLAG
— ———— ———-
600 DDIC 64

UFLAG : 64 means ,DDIC user is lock.

Sap
  • Posts about uflag written by SAP Basis Consultant. About; Solution Manager. Random issues faced during Business Process Monitoring (BPM) configuration on Solman 7.2.
  • UPDATE USR02 SET UFLAG = 0 WHERE BNAME = 'SAP.' AND MANDT = xxx To check the account status for DDIC SELECT UFLAG FROM USR02 WHERE BNAME ='DDIC'.

BNAME = User Name

MANDT = Client No

SQL> update SAPSR3.USR02 set UFLAG=0 where BNAME='DDIC' and MANDT=600;

Here SAPSR3 is schema name and 600 is client no

Unlock Sap* User from OS Level / Database /SQL /Oracle level:

SQL> select MANDT, BNAME, UFLAG from .USR02 where MANDT=<Client No> and BNAME='SAP*';

MAN BNAME UFLAG
— ———— ———-
600 DDIC 64

UFLAG : 64 means ,SAP* user is lock.

BNAME = User Name

MANDT = Client No

SQL> update SAPSR3.USR02 set UFLAG=0 where BNAME='SAP*' and MANDT=600;

Sap uflag table

Here SAPSR3 is schema name and 600 is client no.

Example ABAP Source Code to Mass Lock/Unlock SAP users

REPORT ZUSR02 NO STANDARD PAGE HEADING LINE-SIZE 120
LINE-COUNT 90(3).

TABLES: USR02,
USR03.

* XCLASS - User Class
* S_CLASS
* XBNAME - User Name
* S_BNAME
* XLOCK - Lock User
* XNLOCK - Unlock User
* Put an unknown default in case you press the execute button too fast
SELECT-OPTIONS: XCLASS FOR USR02-CLASS DEFAULT 'XXX'.
SELECT-OPTIONS: XBNAME FOR USR02-BNAME.
SELECTION-SCREEN SKIP.
PARAMETERS: XLOCK RADIOBUTTON GROUP X1,
XNLOCK RADIOBUTTON GROUP X1 DEFAULT 'X'.
SELECTION-SCREEN SKIP.
PARAMETERS: S_CLASS RADIOBUTTON GROUP R1,
S_BNAME RADIOBUTTON GROUP R1.
DATA: WCLASS LIKE USR02-CLASS,
WLOCK(6).

Sap Uflag Table

Uflag

When we don't have any user to login into SAP ABAP level to unlock sap* and ddic user ,Mostly it requires in client 000 as it is supported by SAP BASIS Team . In this case we can unlock sap* or ddic user from OS level / Databse / Sql Level

Unlock DDIC User from OS Level / database /SQL /Oracle level:

Unlock SAP. on DB2. Execute the following command. UPDATE SAPSCHEMA.USR02 set UFLAG=0 where BNAME='SAP.' and MANDT='000' Reset / Delete SAP. on DB2. Execute the following command. DELETE SAPSCHEMA.USR02 where BNAME='SAP.'and MANDT='000' Note. SAPSCHEMA is the database schema. MANDT is the client number. If we can reach the SAP system from database via SQLPLUS tool then we can lock or unlock any SAP users without the SAPGUI. Let's look a little bit closer with some examples; First of all we need to know UFLAG variable. 0 User status is UNLOCK, can logon to SAP system. 32 User status is LOCK with GLOBAL, from Administrator, cannot logon to SAP system.

Login into Sqlplus:

sqlplus / as sysdba

SQL> select MANDT, BNAME, UFLAG from .USR02 where MANDT= and BNAME='DDIC';

MAN BNAME UFLAG
— ———— ———-
600 DDIC 64

UFLAG : 64 means ,DDIC user is lock.

  • Posts about uflag written by SAP Basis Consultant. About; Solution Manager. Random issues faced during Business Process Monitoring (BPM) configuration on Solman 7.2.
  • UPDATE USR02 SET UFLAG = 0 WHERE BNAME = 'SAP.' AND MANDT = xxx To check the account status for DDIC SELECT UFLAG FROM USR02 WHERE BNAME ='DDIC'.

BNAME = User Name

MANDT = Client No

SQL> update SAPSR3.USR02 set UFLAG=0 where BNAME='DDIC' and MANDT=600;

Here SAPSR3 is schema name and 600 is client no

Unlock Sap* User from OS Level / Database /SQL /Oracle level:

SQL> select MANDT, BNAME, UFLAG from .USR02 where MANDT=<Client No> and BNAME='SAP*';

MAN BNAME UFLAG
— ———— ———-
600 DDIC 64

UFLAG : 64 means ,SAP* user is lock.

BNAME = User Name

MANDT = Client No

SQL> update SAPSR3.USR02 set UFLAG=0 where BNAME='SAP*' and MANDT=600;

Here SAPSR3 is schema name and 600 is client no.

Example ABAP Source Code to Mass Lock/Unlock SAP users

REPORT ZUSR02 NO STANDARD PAGE HEADING LINE-SIZE 120
LINE-COUNT 90(3).

TABLES: USR02,
USR03.

* XCLASS - User Class
* S_CLASS
* XBNAME - User Name
* S_BNAME
* XLOCK - Lock User
* XNLOCK - Unlock User
* Put an unknown default in case you press the execute button too fast
SELECT-OPTIONS: XCLASS FOR USR02-CLASS DEFAULT 'XXX'.
SELECT-OPTIONS: XBNAME FOR USR02-BNAME.
SELECTION-SCREEN SKIP.
PARAMETERS: XLOCK RADIOBUTTON GROUP X1,
XNLOCK RADIOBUTTON GROUP X1 DEFAULT 'X'.
SELECTION-SCREEN SKIP.
PARAMETERS: S_CLASS RADIOBUTTON GROUP R1,
S_BNAME RADIOBUTTON GROUP R1.
DATA: WCLASS LIKE USR02-CLASS,
WLOCK(6).

Sap Uflag Table

IF XNLOCK = 'X'.
UPDATE USR02 SET UFLAG = '
WHERE BNAME IN XBNAME.
ELSEIF XLOCK = 'X'.
UPDATE USR02 SET UFLAG = ' 64'
WHERE BNAME IN XBNAME
* User not lock (include yours, just in case)
AND BNAME <> 'SAP*'
AND BNAME <> 'DDIC'.
ENDIF.

IF S_BNAME = 'X'.
PERFORM BNAMERTN.
ELSE.
PERFORM CLASSRTN.
ENDIF.

*---------------------------------------------------------------------*
* FORM BNAMERTN *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM BNAMERTN.
SELECT * FROM USR02 WHERE CLASS IN XCLASS
ORDER BY BNAME.

IF XLOCK = 'X'.
CHECK USR02-UFLAG = ' 64'.
ENDIF.
IF XNLOCK = 'X'.
CHECK USR02-UFLAG = '.
ENDIF.
IF USR02-UFLAG = '64'.
WLOCK = 'Lock'.
ELSE.
WLOCK = 'Unlock'.
ENDIF.
SELECT SINGLE * FROM USR03 WHERE BNAME = USR02-BNAME.
IF SY-SUBRC EQ 0.
WRITE:/001 USR02-CLASS,
016 USR02-BNAME,
031 USR03-NAME1,
064 WLOCK,
071(4) USR03-KOSTL,
078 USR03-ABTLG,
093 USR03-ORT01.
ELSE.
WRITE:/001 USR02-CLASS,
016 USR02-BNAME,
064 WLOCK.
ENDIF.
ENDSELECT.
ENDFORM.

Uflag Sap

*---------------------------------------------------------------------*
* FORM CLASSRTN *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
FORM CLASSRTN.
SELECT * FROM USR02 WHERE CLASS IN XCLASS
ORDER BY CLASS BNAME.
IF XLOCK = 'X'.
CHECK USR02-UFLAG = ' 64'.
ENDIF.
IF XNLOCK = 'X'.
CHECK USR02-UFLAG = '.
ENDIF.
IF USR02-UFLAG = '64'.
WLOCK = 'Lock'.
ELSE.
WLOCK = 'Unlock'.
ENDIF.
SELECT SINGLE * FROM USR03 WHERE BNAME = USR02-BNAME.
IF SY-SUBRC EQ 0.
WRITE:/001 USR02-CLASS,
016 USR02-BNAME,
031 USR03-NAME1,
064 WLOCK,
071(4) USR03-KOSTL,
078 USR03-ABTLG,
093 USR03-ORT01.
ELSE.
WRITE:/001 USR02-CLASS,
016 USR02-BNAME,
064 WLOCK.
ENDIF.
ENDSELECT.
ENDFORM.

Sap Uflag 224

TOP-OF-PAGE.
WRITE:/ SY-DATUM,SY-UZEIT,
50 'XXX PTE LTD',
105 'Page', SY-PAGNO.
WRITE: / SY-REPID, 'SAP User-IDs'.
SKIP.
ULINE.
WRITE: /001 'User Group',
016 'User-ID',
031 'Name',
064 'Sts',
071 'SBU',
078 'Dept',
093 'Location'.
ULINE.

More Function Module
Functions / SAP Script / ALV

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

Sap Usr02 Uflag Values

ABAP Menu:
ABAP Example Hints and Tips

Uflag Sap

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

Sap Usr02 Uflag

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity. Information used on this site is at your own risk.
All product names are trademarks of their respective companies. The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.





broken image