# User, Role and Transaction Authorization Audit Report with Role Assignment History

> A custom ALV report that shows in one audit-ready list who can run a transaction and through which role, which transactions a user is authorized for through which roles, and who added or removed role assignments and when. Composite roles are expanded to single roles, ranges and wildcards in S_TCODE values are resolved, and locked or expired users are shown separately.

- Type: Report, Custom development, ALV report
- Module: BASIS
- Estimated effort: M (8–12 working days)
- Last updated: 2026-11-18
- URL: https://nekuhub.com/en/reports/user-role-transaction-authorization-audit-report/


## Why is the standard not enough?

The user information system (SUIM) answers these questions in separate reports: transaction to users, user to roles and change documents are separate screens and the results come in a technical format. The role-transaction-user matrix and the assignment history are not combined in one list; the file for the auditor is prepared by hand every time and cannot be compared between periods.

### Closest standard alternatives

- SUIM: Offers separate reports for users, roles, transactions and change documents; does not combine them in one audit list.
- PFCG: Shows a role's menu, authorizations and users role by role; does not give a system-wide matrix.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| AGR_USERS | User-role assignment and validity dates | Read | - | ECC + S/4 |
| AGR_1251 | Role authorization values: transactions granted through S_TCODE | Read | AGR_1251-AGR_NAME = AGR_USERS-AGR_NAME | ECC + S/4 |
| AGR_TCODES | Transactions in the role menu | Read | AGR_TCODES-AGR_NAME = AGR_USERS-AGR_NAME | ECC + S/4 |
| AGR_AGRS | Single roles of a composite role | Read | AGR_AGRS-AGR_NAME = AGR_USERS-AGR_NAME | ECC + S/4 |
| AGR_TEXTS | Role description | Read | AGR_TEXTS-AGR_NAME = AGR_USERS-AGR_NAME | ECC + S/4 |
| USR02 | User lock, validity and user type | Read | USR02-BNAME = AGR_USERS-UNAME | ECC + S/4 |
| USR21 | User's person number | Read | USR21-BNAME = AGR_USERS-UNAME | ECC + S/4 |
| ADRP | User's full name | Read | ADRP-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| TSTC | Transaction codes (for resolving ranges and wildcards) | Read | - | ECC + S/4 |
| TSTCT | Transaction code text | Read | TSTCT-TCODE = TSTC-TCODE | ECC + S/4 |
| CDHDR | Role assignment change document header (object class PFCG) | Read | - | ECC + S/4 |
| CDPOS | Role assignment change detail: role added or removed | Read | CDPOS-CHANGENR = CDHDR-CHANGENR | ECC + S/4 |
| USH04 | Profile assignment change history | Read | USH04-BNAME = AGR_USERS-UNAME | ECC + S/4 |

## BAPIs and functions used

- CHANGEDOCUMENT_READ: Reads role assignment change documents

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_TCODE | Transaction code | Range / multiple | TSTC-TCODE | No |
| S_UNAME | User | Range / multiple | AGR_USERS-UNAME | No |
| S_AGR | Role | Range / multiple | AGR_USERS-AGR_NAME | No |
| S_UDATE | Change date (history view) | Range / multiple | CDHDR-UDATE | No |
| P_VIEW | View: transaction / user / role / assignment history | Radio button | - | Yes |
| P_LOCK | Also show locked and expired users | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| User | AGR_USERS-UNAME |
| Full name | ADRP-NAME_TEXT |
| Role | AGR_USERS-AGR_NAME |
| Role description | AGR_TEXTS-TEXT |
| Composite role | Calculated: Name of the composite role if the single role was assigned through it (AGR_AGRS) |
| Transaction | Calculated: Transaction resolved from the S_TCODE value |
| Transaction text | TSTCT-TTEXT |
| Valid from | AGR_USERS-FROM_DAT |
| Valid to | AGR_USERS-TO_DAT |
| User status | Calculated: Active, locked or expired (USR02-UFLAG, USR02-GLTGB) |
| Change | Calculated: Role added or removed (CDPOS change indicator) |
| Changed by | CDHDR-USERNAME |
| Change date | CDHDR-UDATE |

## How does the report work?

1. Role-transaction mapping: the values of authorization object S_TCODE in single roles (AGR_1251) are read; ranges and wildcards are resolved against the transactions in TSTC. Transactions in the role menu (AGR_TCODES) are shown as well; a menu transaction that is not granted through S_TCODE is flagged.
2. Composite roles are expanded to their single roles with AGR_AGRS; access a user gets through a composite role is shown with the composite and single role it comes from.
3. User-role assignments are read from AGR_USERS with their validity dates. Assignments not valid on the report date, locked users (USR02-UFLAG) and users past their validity (USR02-GLTGB) are flagged separately; name and department come from USR21 → ADRP/ADCP.
4. Assignment history: role assignment change documents (CDHDR/CDPOS, object class PFCG, table AGR_USERS) are read for the selected date range; each line shows the role added or removed, its validity, the user who made the change, date and time. USH04 is read as well for the profile assignment history.
5. Views: (a) transaction → users, (b) user → roles → transactions, (c) role → users, (d) assignment history. Each view is exported to Excel in audit format with a heading, run date, selection criteria and the user who ran it.
6. Note: S_TCODE shows the ability to start a transaction; object checks inside the transaction (e.g. company code, document type) also apply. The report states this as a note on every output; for detailed object checks it is used together with the critical authorization and segregation of duties reports.

## Authorization objects

- S_USER_GRP: Displaying user master data by user group
- S_USER_AGR: Displaying roles
- S_USER_TCD: Displaying transactions in roles

## Frequently asked questions

### Does the report prove that a user can really perform the activity?

S_TCODE shows the ability to start the transaction. Object checks inside the transaction (company code, document type, activity) also apply. The report states this limit as a note on every output; for object-level audits it should be used together with the critical authorization and segregation of duties reports.

### How far back does the role assignment history go?

Role assignment change documents remain in the system as long as they are not deleted or archived; the report reads them for the selected date range. If change documents have been archived, the history view goes back to the archiving date.

---
Let us build this report for your system: https://nekuhub.com/en/request-a-quote/?report=basis-user-role-authorization-audit
