User Lock Status In Sap



  1. Sap Security Trace
  2. Sap User Status Codes

Different methods to Lock or Unlock SAP users

I want to lock all the users in SAP during upgrade, support package installations etc. I know using SU10 we can do it. Any other alternative ways to lock the users.

Is there a way in SAP to unlock a locked user for a limited time, then automatically after x time set the user back to lock status?

You can fill in “valid from” and “valid until”, but you cannot say from Monday to Friday from 8 – 12:00 for part time workers.

  • 1) Sometimes, users forgot the userid or password and try to login with wrong credentials. After 3 or more unsuccessful attempts, user id will get locked with the message to user “user id locked due to x unsuccessful attempts.Contact system administrator”.
  • User status 0 User not locked 32 (Hex 20) Locked by CUA central administrator 64 (Hex 40) Locked by administrator 128 (Hex 80) Locked after failed logon. More than one lock can occur at a time. In this case, the field contains the total of the values.

Different methods to Lock or Unlock SAP users. I want to lock all the users in SAP during upgrade, support package installations etc. I know using SU10 we can do it. Any other alternative ways to lock the users. Is there a way in SAP to unlock a locked user for a limited time, then automatically after x time set the user back to lock status? Note that this is not available for other SAP Applications. Advantage with this method is that the application sets a flag for already locked users. You can now select the users who should not be locked (Euro Administrator) and save the transaction. Click on lock user and all the users are now locked.

Can we schedule to lock all users?

If users get locked, from SU01 you can unlock them.

Use SU10 to mass lock/unlock the users.

Use address data or authorisation data to get a list of users – select the ones you want and click transfer. Once this is done click on lock or unlock.

You can also use transaction code EWZ5 to mass lock/unlock the users or execute the program EWULKUSR in SE38

or

set a profile parameter (login/failed_user_auto_unlock) to unlock at midnight the locked users.

or

An ABAP code as below:

REPORT zreusrlock. DATA: time_limit TYPE sy-datum.
DATA: days TYPE i VALUE 40.

time_limit = sy-datum - days.
UPDATE usr02 SET uflag = 64 WHERE trdat < time_limit.

If time is not specified in the program, you can use SM37 to schedule it as a daily background job with the date and time.

or

Write an sqlplus SQL script that sets all the UFLAG fields in table USR02 to 64 (lock)EXCEPT for the BNAMEs you don’t want locked. When you are done, you can do the same again but change the UFLAG field to 0 (unlock).

Sap

The SQL statement would look like:

update SAPR3.USR02 set UFLAG = 64 where MANDT = <client number> and BNAME != <don’t lock user 1> and BNAME != <don’t lock user 2>;

You can replace != with <> if you want. To run this from an OS command line, you would type:

Unix/Oracle 9:–> sqlplus /nolog @<SQLpath+SQLname>
NT/Oracle 9: —> sqlplus /nolog @<SQLpath+SQLname>

To automate, in UNIX the script can be added in the crontab entries. In NT, it can automated via schedule a task.

or

This is another method to UNLOCK ALL users.

Start Oracle Server manager (If in Oracle Environment)
– connect internal
– update sapr3.usr02 set uflag=’0′ where mandt='<client no.>’;

When users are locked, the uflag is set to 64. Zero (0) means user in not locked.

To verify, use a sql query statement:

select bname, uflag from sapr3.usr02 where mandt='<client no.>’;

Is there a way to set a list of users that cannot be locked, even if we try to lock them manually, and even if they fail connection ( wrong password )?

Increase this parameter in SAP Instance profile:

login/fails_to_user_lock = 6 (max is 99 wrong attempts, i.e, value 99). Currently you have a value of 3.

login/failed_user_auto_unlock (for your midnight unlocking).

Different methods to Lock or Unlock SAP users

I want to lock all the users in SAP during upgrade, support package installations etc. I know using SU10 we can do it. Any other alternative ways to lock the users.

Is there a way in SAP to unlock a locked user for a limited time, then automatically after x time set the user back to lock status?

You can fill in “valid from” and “valid until”, but you cannot say from Monday to Friday from 8 – 12:00 for part time workers.

Can we schedule to lock all users?

If users get locked, from SU01 you can unlock them.

Use SU10 to mass lock/unlock the users.

Use address data or authorisation data to get a list of users – select the ones you want and click transfer. Once this is done click on lock or unlock.

You can also use transaction code EWZ5 to mass lock/unlock the users or execute the program EWULKUSR in SE38

or

Sap Security Trace

set a profile parameter (login/failed_user_auto_unlock) to unlock at midnight the locked users.

or

An ABAP code as below:

REPORT zreusrlock. DATA: time_limit TYPE sy-datum.
DATA: days TYPE i VALUE 40.

time_limit = sy-datum - days.
UPDATE usr02 SET uflag = 64 WHERE trdat < time_limit.

If time is not specified in the program, you can use SM37 to schedule it as a daily background job with the date and time.

or

Write an sqlplus SQL script that sets all the UFLAG fields in table USR02 to 64 (lock)EXCEPT for the BNAMEs you don’t want locked. When you are done, you can do the same again but change the UFLAG field to 0 (unlock).

The SQL statement would look like:

update SAPR3.USR02 set UFLAG = 64 where MANDT = <client number> and BNAME != <don’t lock user 1> and BNAME != <don’t lock user 2>;

You can replace != with <> if you want. To run this from an OS command line, you would type:

Unix/Oracle 9:–> sqlplus /nolog @<SQLpath+SQLname>
NT/Oracle 9: —> sqlplus /nolog @<SQLpath+SQLname>

To automate, in UNIX the script can be added in the crontab entries. In NT, it can automated via schedule a task.

User lock in sap

or

This is another method to UNLOCK ALL users.

Start Oracle Server manager (If in Oracle Environment)
– connect internal
– update sapr3.usr02 set uflag=’0′ where mandt='<client no.>’;

When users are locked, the uflag is set to 64. Zero (0) means user in not locked.

To verify, use a sql query statement:

select bname, uflag from sapr3.usr02 where mandt='<client no.>’;

Is there a way to set a list of users that cannot be locked, even if we try to lock them manually, and even if they fail connection ( wrong password )?

Increase this parameter in SAP Instance profile:

login/fails_to_user_lock = 6 (max is 99 wrong attempts, i.e, value 99). Currently you have a value of 3.

Sap User Status Codes

login/failed_user_auto_unlock (for your midnight unlocking).