Tuesday, November 07, 2006

Locking/Unlocking accounts - Behind the scenes

What goes on behind the scenes? What does the system do to actually set this?

User accounts can be locked/unlocked via SU01 (User Maintenance.)

What goes on behind the scenes? What does the system do to actually set this?

The table USR02 gets updated. The field UFLAG determines if the user account is locked or unlocked. The value "64" indicates that the user account is locked. The value "0" that the user account is unlocked.

Eg :
Table : USR02
Displayed fields: 22 of 33 Fixed columns: 2 List width 0250

MANDT BNAME BCODE GLTGV GLTGB USTYP CLASS LOCNT UFLAG

100 BOB 81CCFA477B092CA8 00.00.0000 00.00.0000 A 0 0
100 DDIC 83E936FF3B320883 00.00.0000 00.00.0000 A SUPER 0 0
100 MICK ABD33CA1D4378FE2 00.00.0000 00.00.0000 A SUPER 0 0
100 SAPCPIC FC49DBF6F3FDCF36 00.00.0000 00.00.0000 C 0 0
100 SAPUSERTMS 5C6A3F50AFF412F6 00.00.0000 00.00.0000 A SUPER 0 0
100 TEST BA74379A753E51E300.00.000000.00.0000A 2 64

Knowing this, you can then issue an update statement at the database level that locks all users in mass.

Don't lock yourself out, though! Use exceptions for super user accounts in your update statement.

Notice that 4.6b and above have made improvements to this kind of task, making the locking/unlocking a bit easier. However, changing at the database level is much faster and it is just one simple query.

No comments: