Active users extraction and link to the company codes
The objective of this document is to provide the way to check if a user is actually active and how to understand if the same is linked to one or more company codes. This can be helpful in case of carve out / sales of a division (possible in multi – division / multinational companies)..
1) In the table USR02 (transaction SE11 / SE16) it is possible to display for every user:
– the validity date (when the user expires – field GLTGB);
– the status (active, deactivated, invalid) – field CLASS)
– user lock status (0 = user not locked; 32 = locked globally by administrator; 64=locked locally by administrator; 128 = locked due to incorrect logon)
2) The table AGR_USER contains the link between the user and the associated authorization roles.
If we want to display which roles are associated to the users displayed in the previous step, just get in the table with the list of users in the filed UNAME and check the field AGR_NAME:
3) The link between the user and the company code is not direct: the user is linked to an authorization profile, the authorization profile is linked to the company code.
In the table AGR_1252 we find the link AUTHORIZATION PROFILE – COMPANY CODE.
To pick up this information, use as selection criteria the roles output of the previous step and, in the “Org.level” field, select the value $BUKRS (in capital letters), as per below picture:
The output will be the following:
In case of multiple companies per user, the values other than the first will be contained in the adjacent field (in the example, PL12 and PL13).
Via vlookup in excel match the list obtained here (role – company code) with the one in output at step 2 (user – role).