Last reviewed · Rinexis SAP security team
An SAP authorization trace records every authorization check the kernel performs for a user: the authorization object, the field values checked and the return code. It is run with ST01 (system trace, authorization component) on one application server or STAUTHTRACE across all servers, and it is the reliable way to see exactly which checks a transaction makes.
Why trace instead of SU53
SU53 shows only the last failed check for a user. That is enough for a simple error, but many programs check several objects, check one object several times with different values, or catch a failed check silently and carry on with reduced function. SU53 then points at the wrong object or shows nothing useful.
A trace records the full sequence: every successful and failed check, in order, with the values the program asked for. Use it when SU53 is inconclusive, when building or testing a role, when documenting what a custom transaction checks, and when deciding which authorization objects a technical user really needs.
ST01 vs STAUTHTRACE vs long-term traces
| Tool | Scope | Typical use |
|---|---|---|
ST01 | System trace on the current application server only. Components include authorization checks, kernel functions, database access, table buffer, RFC and lock operations. | Quick trace of one user on one server; combining authorization checks with other trace components |
STAUTHTRACE | Authorization checks only. Can be switched on and evaluated system-wide across all application servers. | Day-to-day authorization troubleshooting and role testing; the usual first choice |
STUSERTRACE | Long-term user trace, switched on by profile parameter auth/auth_user_trace. Records each distinct check per user and application over weeks. | Building a role for a technical or interface user from what it actually does |
STUSOBTRACE | Long-term authorization trace per application, switched on by profile parameter auth/authorization_trace. Feeds the trace evaluation in SU24. | Collecting authorization default values for custom transactions, RFC function modules and services |
The most common ST01 mistake is tracing the wrong server. With logon load balancing the user may land on a different application server from the one where you switched the trace on, and ST01 records nothing. STAUTHTRACE avoids this by activating on all servers.
How to run an authorization trace
- Agree the test with the user, or reproduce the problem yourself with a test user that holds the same roles. Never trace with a user that holds
SAP_ALL: every check succeeds and the trace shows nothing about what is missing. - Open
STAUTHTRACE, enter the user name as a filter, and activate the trace system-wide. InST01, select the authorization check component, set the user filter under the filter options, and switch the trace on. - Have the user run the transaction through every realistic path: create, change, display, save, print, and any buttons or tabs that call other functions.
- Switch the trace off as soon as the test is complete.
- Evaluate the trace, filtered by user and time window, and if available choose to show unique entries only so repeated identical checks collapse into one line.
Background jobs and RFC calls run under their own user, so filter on the step user of the job or the user stored in the RFC destination, not on the person who scheduled or triggered it.
Reading the results and return codes
Each line shows the time, user, client, transaction or program, the authorization object, the fields with the values checked, and a return code. The return code matches sy-subrc after the ABAP AUTHORITY-CHECK statement.
| Return code | Meaning | What to do |
|---|---|---|
| 0 | Check passed: the user holds the object with these values | Nothing; note it as a required authorization for the role |
| 4 | User holds the object, but not with the values checked | Compare the checked values, often ACTVT or an org-level field such as BUKRS, with the role |
| 12 | User holds no authorization at all for this object | Decide whether the object belongs in the role; check the application's SU24 proposals |
Not every failed line is a problem. Programs often probe an object to decide whether to show a button or a field, and treat a 4 or 12 as a normal answer. Look for the failed check that sits just before the error message, and confirm by granting in a test system rather than production.
From trace to least-privilege role
A trace tells you what was checked, not what should be granted. Turn it into role content through SU24 and PFCG rather than by typing values into a role by hand.
- For custom transactions, open the transaction in SU24, use the trace evaluation to add the traced objects, and review each one: set proposal Yes with the values that match the job, or No where the object must be granted deliberately.
- Add the transaction to the role menu in PFCG so the role picks up the proposals as standard authorizations, then fill org levels.
- Where a single role needs a value that SU24 should not propose for everyone, maintain it in PFCG and document why.
- Retest with the trace on, using a user that holds only the new role, until the business steps complete with no unexplained failed checks.
For interface and background users, a long-term user trace over a full business cycle (month end, quarter end) gives a much better picture than a one-off test. It is how teams replace broad grants such as S_RFC with * or a copied SAP_ALL with a role that lists exactly the function groups and objects the user calls.
Performance, retention and data protection
- Traces cost performance. An unfiltered system trace on a busy production server writes a large volume quickly. Always filter by user and switch off promptly.
- ST01 and STAUTHTRACE trace files are limited in size and are overwritten, so evaluate soon after the test. Do not rely on them as evidence that must be kept.
- Trace data is personal data: it shows who ran which transaction, when, and against which org values. Restrict who can switch on and evaluate traces, and include long-term traces in your data-protection assessment.
- Long-term traces switched on by profile parameter stay on until someone switches them off. Put the parameter change through change control, record an end date, and check the setting in
RZ11afterwards. - Switching traces on in production is itself a privileged action. Treat the authorization for it as critical access.
Frequently asked questions
What is the difference between ST01 and STAUTHTRACE?
ST01 is the general system trace and runs on the application server where it is switched on; authorization checks are one of several components. STAUTHTRACE traces only authorization checks and can be activated and evaluated across all application servers, so it is usually the better choice for authorization work.
What does return code 4 mean in an SAP authorization trace?
Return code 4 means the user holds an authorization for the object, but not with the field values the program checked. Typical causes are a missing activity value, such as change instead of display, or a missing organizational value such as a company code or plant.
What does return code 12 mean in an authorization trace?
Return code 12 means the user has no authorization at all for the checked object. Before adding it to a role, confirm that the check is actually needed for the business task, because many programs test objects only to decide which functions or fields to show.
Should I use SU53 or an authorization trace?
Start with SU53 for a single, simple authorization error because it is quick. Switch to a trace when SU53 shows nothing useful, when the program checks several objects, when you are building or testing a role, or when you need the complete list of checks a transaction performs.
Can I run an authorization trace in production?
Yes, but filter it to one user, keep it short and switch it off straight away, because traces affect performance and record personal data. Many teams reproduce the issue in a test system first and trace in production only when the problem cannot be reproduced.
Our authorization design work uses traces and SU24 maintenance to build roles from what users and interfaces actually check, instead of from wildcards. Tcodex helps on the custom side: it classifies every transaction by SE93 type and what it runs, and flags custom wrapper transactions that call standard ones, which are exactly the transactions whose checks you need to trace and document.
Once roles are rebuilt, Sodly matches their transactions and authorizations against your ruleset so a tighter role does not hide a new SoD conflict.