# User and Transaction Code Usage History Archive and Report

> A custom ALV report that writes user × transaction usage from the workload statistics to a permanent archive table every month and reports from that archive retrospectively. It answers in one list who used which transaction how often in which month, when the first and last use were, and which transactions are in a user's roles but never used, for audits and role clean-up.

- 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-and-transaction-usage-history-archive/


## Why is the standard not enough?

ST03N shows usage by user and transaction, but detailed data is kept only for the period set in the system and is then deleted; a question about usage a year ago has no answer. SUIM lists the transactions a user is authorized for but does not compare them with usage. Finding transactions that are authorized but never used means joining two lists by hand.

### Closest standard alternatives

- ST03N: Shows usage by user and transaction; the detail is kept for a limited time and is not compared with roles.
- SUIM: Lists the transactions users are authorized for; does not show actual usage.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| USR02 | User type, lock status, last logon | Read | - | ECC + S/4 |
| USR21 | User's address and person number | Read | USR21-BNAME = USR02-BNAME | ECC + S/4 |
| ADRP | User's full name | Read | ADRP-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| ADCP | User's department | Read | ADCP-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| TSTC | Transaction code and program | Read | - | ECC + S/4 |
| TSTCT | Transaction code text | Read | TSTCT-TCODE = TSTC-TCODE | ECC + S/4 |
| AGR_USERS | User's valid roles | Read | AGR_USERS-UNAME = USR02-BNAME | ECC + S/4 |
| AGR_1251 | Transactions granted in roles through S_TCODE | Read | AGR_1251-AGR_NAME = AGR_USERS-AGR_NAME | ECC + S/4 |

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| S_BNAME | User | Range / multiple | USR02-BNAME | No |
| S_TCODE | Transaction code | Range / multiple | TSTC-TCODE | No |
| S_MONTH | Month (YYYYMM) | Range / multiple | - | Yes |
| S_AGR | Role | Range / multiple | AGR_USERS-AGR_NAME | No |
| P_UNUSED | Show transactions in roles that were not used | Checkbox | - | No |
| P_ARCH | Archive the previous month (background job) | Checkbox | - | No |

## Output columns

| Column | Source |
|---|---|
| User | USR02-BNAME |
| Full name | ADRP-NAME_TEXT |
| Department | ADCP-DEPARTMENT |
| User type | USR02-USTYP |
| Transaction | TSTC-TCODE |
| Transaction text | TSTCT-TTEXT |
| Dialog steps | Calculated: Total dialog steps in the selected months (from the archive) |
| First month used | Calculated: Earliest month in the archive with steps > 0 |
| Last month used | Calculated: Latest month in the archive with steps > 0 |
| In a role | Calculated: Whether the transaction is granted through S_TCODE in a valid role of the user |
| Last logon | USR02-TRDAT |

## How does the report work?

1. A monthly background job reads the user × transaction totals of the previous month from the workload collector with SWNC_COLLECTOR_GET_AGGREGATES for all application servers (number of dialog steps, total response time, task type).
2. The totals are written to a permanent archive table defined during installation, keyed by month, system, user and transaction. Running the same month again overwrites the records, so no duplicates arise; the retention period of the archive follows the company's record retention policy.
3. The report enriches the archive with user master data: user type, lock status and last logon (USR02), name and department (USR21 → ADRP/ADCP), transaction text (TSTC/TSTCT).
4. Role comparison: the user's valid roles (AGR_USERS) and the transactions granted in them through S_TCODE (AGR_1251, with ranges and wildcards resolved) are read. Transactions that are in the roles but were never used in the selected period, and transactions that were used although they are not in a role (for example called through another authorization), are flagged separately.
5. Views: user × transaction × month matrix, number of users per transaction, share of unused transactions per role. The user drills down from a line to the monthly detail.
6. It works the same in S/4HANA and ECC; the workload collector is read with the same function in both releases.

## Authorization objects

- S_TOOLS_EX: Viewing user-level data in workload statistics
- S_USER_GRP: Displaying user master data by user group
- S_BTCH_JOB: Scheduling the monthly archiving job

## Frequently asked questions

### Does usage data count as personal data, and how should it be kept?

Usage per user is a record that can be linked to an employee. The archive is kept only for authorization and audit purposes, its retention period follows the company's record retention policy and access to the report is limited to Basis, authorization management and audit. If required, older months can be kept with an anonymous key instead of the user name.

### How far back can the archive start?

On the first run, the archive takes the monthly totals still available in the workload collector; how far back that goes depends on the retention setting in the system. From then on every month is added and the data is no longer deleted.

### Should a transaction that is in a role but unused be removed at once?

No. Rare activities such as year-end closing or yearly tasks can look unused over a short period. Run the report over at least 12 months and decide on removal together with the role owner.

---
Let us build this report for your system: https://nekuhub.com/en/request-a-quote/?report=basis-transaction-usage-history-archive
