Skip to content
Tutorials Center
My learning

Topics

Lesson 25 of 36 ยท Basis and Administration

Users, Roles and Authorizations

Learn the SAP authorization concept: users (SU01), roles (PFCG), authorization objects, fields, S_TCODE, SU53 analysis and segregation of duties.

An ERP system holds payroll, bank details and customer contracts, so the question "who may do what?" is central. SAP answers it with a layered authorization concept: users get roles, roles contain authorizations, and authorizations are checked by the program every time it does something sensitive. This lesson explains each layer, the tcodes to manage them and how to find out why a user got a "You are not authorized" message.

SAP is not available on this site, so everything below is described, and the runnable code is a labelled JavaScript stand-in of the check logic.

The layers

flowchart LR
  U["User<br/>SU01"] --> R["Role<br/>PFCG"]
  R --> P["Profile<br/>(generated)"]
  P --> A["Authorization<br/>(object + field values)"]
  A --> O["Authorization object<br/>(defined by developer)"]

Users never receive authorizations directly. They get roles; the system generates a profile from each role.

Users

Created in SU01 (single) or SU10 (mass). The important fields:

  • User ID and user type: Dialog (a human using the GUI), System (background and interface processing), Communication (RFC, no GUI) and Service (anonymous shared use). Technical users must not be dialog users.
  • Initial password (must change at first login) and validity dates.
  • Roles (tab Roles) and parameters.

Users are locked after too many wrong passwords (SU01 unlocks, or SU10 for many). Password rules are set by profile parameters such as login/min_password_lng, maintained in RZ10.

Roles and PFCG

A role is a set of authorizations plus a menu. In PFCG you:

  1. Create the role, for example Z_FI_AP_CLERK.
  2. On the Menu tab, add the tcodes the user should see.
  3. On the Authorizations tab, SAP proposes authorization data from those tcodes (the authorization default data, tables USOBT_C/USOBX_C, maintained in SU24). You then fill the open organizational levels (company code, plant) and fix any open fields.
  4. Generate the profile.
  5. On the User tab, assign users and compare the user master data.

Roles can be single or composite (a role made of other roles) or derived (the same authorizations, different organizational values, so one inherited role is reused per company code).

Authorization objects

An authorization object is a template with up to ten fields that a developer checks. Take F_BKPF_BUK (accounting document: company code). It has the fields BUKRS (company code) and ACTVT (activity). A user passes the check only if one of their authorizations contains the needed values.

Common activity values: 01 create, 02 change, 03 display, 06 delete, 16 execute.

Programs check with the ABAP statement AUTHORITY-CHECK OBJECT 'F_BKPF_BUK' ID 'BUKRS' FIELD '1000' ID 'ACTVT' FIELD '03'. which sets sy-subrc to 0 when allowed. The most basic object is S_TCODE: it decides whether you may start a transaction at all. Remember that passing S_TCODE is not enough. Almost every transaction then checks business objects too.

When a check fails: SU53

The user who saw the "No authorization" message calls SU53 straight afterwards, and the screen shows the last failed authorization check: object, field values required and the values the user actually has. The security administrator uses this (or ST01, the authorization trace) to adjust the role. It is the first tool for any authorization question, so memorize it.

JS Stand-in: an authorization check

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Note the important rule the code shows: within one authorization all fields must match, but across authorizations of the same object any one may. This is why mixing company 1000 (display only) and 2000 (full) in two authorizations does not grant change rights in 1000.

Segregation of duties

Good security prevents one person from completing a risky chain alone: the person who creates a vendor should not also post the payment to that vendor. This is segregation of duties (SoD). Companies define conflict rules, such as "create vendor" + "pay vendor", and audit users against them. Tools such as SAP GRC (Access Control) automate this, but the principle can be checked by hand.

JS Stand-in: a segregation of duties check

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Good practice

  • Least privilege: give the minimum, and use roles instead of profiles.
  • Never copy SAP_ALL or SAP_NEW to a production dialog user.
  • Firefighter (emergency) access is logged and temporary.
  • Review users and roles on a schedule, and remove leavers.
  • Authorization changes are transported like other changes, as seen in Transports and the System Landscape.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which tcode maintains roles?

    PFCG is the profile generator for roles. SU01 maintains users.
  2. 2. A user gets a 'no authorization' message. Which tcode shows the failed check?

    SU53 displays the last failed authorization check of the user.
  3. 3. How are the fields of one authorization object checked?

    All fields of the check must be satisfied within a single authorization.
  4. 4. What does segregation of duties aim to prevent?

    SoD splits conflicting tasks, such as creating a vendor and paying that vendor.

Summary

  • Users receive roles; roles produce profiles of authorizations.
  • PFCG builds roles, SU24 holds proposals, SU01 maintains users.
  • Authorization objects have fields; all fields must match in one authorization.
  • SU53 and ST01 explain failed checks.
  • Apply least privilege and segregation of duties.

Next: Background Jobs, Monitoring and Housekeeping