# Expiring and Expired Role Assignments Report

> A custom ALV report that lists role assignments whose validity ends within the next N days or that have ended but are still on the user, with the user's email, the parent role, user validity and last logon. It also flags expired assignments whose profile is still in the user master because the user comparison (PFUD) has not run, and it can send reminder emails to users.

- Type: Report, Custom development, ALV report
- Module: BASIS
- Estimated effort: S (3–4 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/reports/expiring-and-expired-role-assignments-report/


## Why is the standard not enough?

SU01 and PFCG show the validity dates of a role assignment one user or role at a time. Role assignments can be listed in SUIM, but there is no window such as "ending in the next 30 days", no days-left calculation and no reminder to the user's email. If the profile of an expired assignment is still on the user because PFUD has not run, the standard list does not show that either.

### Closest standard alternatives

- SUIM: Lists role assignments; no end window, days left, PFUD need or email reminder.
- PFCG: Shows the users of a role and their validity dates one role at a time.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| AGR_USERS | User-to-role assignment, validity and change date (driving table) | Read | - | ECC + S/4 |
| AGR_TEXTS | Role description | Read | AGR_TEXTS-AGR_NAME = AGR_USERS-AGR_NAME AND AGR_TEXTS-SPRAS = SY-LANGU AND AGR_TEXTS-LINE = 0 | ECC + S/4 |
| AGR_DEFINE | Parent role of a derived role | Read | AGR_DEFINE-AGR_NAME = AGR_USERS-AGR_NAME | ECC + S/4 |
| AGR_1016 | Generated profile of the role | Read | AGR_1016-AGR_NAME = AGR_USERS-AGR_NAME | ECC + S/4 |
| UST04 | Whether the profile is still on the user | Read | UST04-BNAME = AGR_USERS-UNAME AND UST04-PROFILE = AGR_1016-PROFILE | ECC + S/4 |
| USR02 | User group, user validity and last logon | Read | USR02-BNAME = AGR_USERS-UNAME | ECC + S/4 |
| USR21 | Person and address number of the user | Read | USR21-BNAME = AGR_USERS-UNAME | ECC + S/4 |
| ADRP | Full name of the user | Read | ADRP-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| ADR6 | Email address of the user for the reminder | Read | ADR6-ADDRNUMBER = USR21-ADDRNUMBER AND ADR6-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_UNAME | User | Range / multiple | AGR_USERS-UNAME | No |
| S_AGR | Role | Range / multiple | AGR_USERS-AGR_NAME | No |
| S_CLASS | User group | Range / multiple | USR02-CLASS | No |
| P_DAYS | Next number of days | Single value | - | Yes |
| P_EXPIR | Also show expired assignments | Checkbox | - | No |
| P_PFUD | Flag assignments whose profile is still on the user | Checkbox | - | No |
| P_MAIL | Send reminder emails to users | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| User | AGR_USERS-UNAME |
| Full name | ADRP-NAME_TEXT |
| Email | ADR6-SMTP_ADDR |
| User group | USR02-CLASS |
| Role | AGR_USERS-AGR_NAME |
| Role description | AGR_TEXTS-TEXT |
| Parent role | AGR_DEFINE-PARENT_AGR |
| Valid from | AGR_USERS-FROM_DAT |
| Valid to | AGR_USERS-TO_DAT |
| Days left | Calculated: AGR_USERS-TO_DAT − today |
| Status | Calculated: Expiring / Expired / Expired, user comparison needed (profile in UST04) |
| User valid to | USR02-GLTGB |
| Last logon | USR02-TRDAT |
| Assignment changed on | AGR_USERS-CHANGE_DAT |

## How does the report work?

1. Assignments of the selected users and roles are read from AGR_USERS; those whose validity end (TO_DAT) is between today and today + N days and, depending on the selection, those already ended are taken. Unlimited assignments (31.12.9999) are left out.
2. Days left = TO_DAT − today; a negative value means the assignment has expired.
3. For expired assignments, the role's profile is taken from AGR_1016; if it is still on the user in UST04, the flag "user comparison needed" is set.
4. The role description is added from AGR_TEXTS and the parent role of a derived role from AGR_DEFINE.
5. User group, user validity end and last logon are added from USR02; full name and email from USR21/ADRP/ADR6. If the user's own validity ends before the role assignment, this is noted as well.
6. The result is sorted by days left; if the email option is on, each user receives the list of their ending roles.

## Authorization objects

- S_USER_GRP: Display user data by user group (ACTVT 03)
- S_USER_AGR: Display role assignments

## Frequently asked questions

### Does the report extend or remove assignments automatically?

No. The report only lists and reminds; an extension decision should go through approval. To remove expired profiles from users, the standard user comparison (report PFCG_TIME_DEPENDENCY) should be scheduled as a daily job.

### How do single roles inside composite roles appear?

When a composite role is assigned, its single roles are also stored in AGR_USERS with the same dates. Depending on the selection, the report shows only the composite role or the single roles as well; by default it lists at composite level to avoid duplicates.

### Is an email also sent to the role owner?

In the basic version the email goes to the user. If role owners are defined per role in a settings table, they can also receive a summary of their roles; this takes about one extra day.

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