# User License Type and Last Logon Report (Inactive Users)

> A custom ALV report that shows each user's license type, last logon date, number of valid roles and department in one list. Users who have not logged on for a long time, never logged on, are past their validity but not locked, or have no license type are flagged, which makes the clean-up before license measurement straightforward.

- Type: Report, Custom development, ALV report
- Module: BASIS
- Estimated effort: S (2–4 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/reports/user-license-type-and-last-logon-report/


## Why is the standard not enough?

SUIM can list users by last logon date and SU01 shows the license type per user. No standard screen, however, combines license type, last logon, number of valid roles and department; to find users with a Professional license who have not logged on for months before license measurement, several lists are merged in Excel. The custom report does this in one run and writes the finding per line.

### Closest standard alternatives

- SUIM: Lists users by last logon date; license type, department and number of valid roles are not in the same list.
- SU01: Shows license type and logon data for one user at a time.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| USR02 | User type, group, validity, lock and last logon date (driving table) | Read | - | ECC + S/4 |
| USR06 | License type assigned for license measurement | Read | USR06-BNAME = USR02-BNAME | ECC + S/4 |
| AGR_USERS | Number of valid role assignments | Read | AGR_USERS-UNAME = USR02-BNAME | ECC + S/4 |
| USR21 | Person and address number of the user | Read | USR21-BNAME = USR02-BNAME | ECC + S/4 |
| ADRP | Full name | Read | ADRP-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| ADCP | Department | Read | ADCP-PERSNUMBER = USR21-PERSNUMBER AND ADCP-ADDRNUMBER = USR21-ADDRNUMBER | ECC + S/4 |

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_UNAME | User | Range / multiple | USR02-BNAME | No |
| S_CLASS | User group | Range / multiple | USR02-CLASS | No |
| S_USTYP | User type | Range / multiple | USR02-USTYP | No |
| S_LICTY | License type | Range / multiple | USR06-LIC_TYPE | No |
| P_DAYS | Inactivity threshold (days) | Single value | - | Yes |
| P_FINDO | Users with findings only | Checkbox | - | No |
| P_LOCKD | Include locked users | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| User | USR02-BNAME |
| Full name | ADRP-NAME_TEXT |
| Department | ADCP-DEPARTMENT |
| User type | USR02-USTYP |
| User group | USR02-CLASS |
| License type | USR06-LIC_TYPE |
| Valid to | USR02-GLTGB |
| Lock status | USR02-UFLAG |
| Last logon | USR02-TRDAT |
| Inactive days | Calculated: Key date − USR02-TRDAT (no logon: − USR02-ERDAT) |
| Valid roles | Calculated: Number of AGR_USERS entries valid on the key date |
| Finding | Calculated: Threshold exceeded, never logged on, validity ended, no license type or no role |

## How does the report work?

1. Users in the selection are read from USR02: user type (USTYP), user group (CLASS), validity (GLTGV, GLTGB), lock status (UFLAG), creation date (ERDAT) and last logon date (TRDAT).
2. The license type (LIC_TYPE) is added from USR06 and shown with its USMM text; users without an entry are flagged as "no license type".
3. Role assignments valid on the key date are counted from AGR_USERS.
4. Inactive days = key date − TRDAT. For users who never logged on (TRDAT empty), the days since the creation date are used.
5. Findings: inactivity threshold exceeded; never logged on; validity ended but not locked; no license type assigned; active user without any valid role.
6. Full name and department are added from ADRP and ADCP through USR21. The result is listed with subtotals per license type.

## Authorization objects

- S_USER_GRP: Display authorization for user data by user group
- S_USER_AGR: Display authorization for role assignments

## Frequently asked questions

### Does the report read password data?

No. From USR02 the report only reads administrative fields such as user type, group, validity, lock and last logon date; no field related to passwords or password hashes is selected.

### Can I lock inactive users from the report?

The report only lists. Approved users can be locked in bulk with SU10, or the separate automatic lock program can run on a schedule.

### Why do users without a license type matter?

In license measurement, dialog users without an assigned type are usually counted in the highest category. Assigning the right type before measurement avoids unexpected license differences.

---
Let us build this report for your system: https://nekuhub.com/en/request-a-quote/?report=basis-user-license-type-last-logon
