Maintaining User Authorizations with Roles and Profiles

Objectives

After completing this lesson, you will be able to:
  • Describe the authorization concept of AS ABAP based SAP systems
  • Explain the relation between authorization objects and authorization checks
  • Create an authorization role using the role maintenance transaction

Authorization Concept

Users can log on to a client of an SAP system if they have a user master record and they know their user name and password, and if the user type is authorized for the logon type. For example, a communication or system user cannot log on using SAP GUI.

After the users have logged on to the SAP system, they will start working productively by calling applications. As the figure Users and Authorizations shows, in the SAP system, there is an authorization check every time an application is called.

If users attempt to start an application they are not authorized to, the system rejects the user by displaying an error message. If the user starts an allowed application, the system displays the initial screen of this application. Depending on the application called, the user enters data and performs actions on this screen. There may be additional authorization checks for the data and actions to be protected.

Authorization Objects and Authorization Checks

To understand the ABAP authorization concept, and to create your own roles and authorizations, you need a basic knowledge of roles and authorization profiles in the user master record.

In an ABAP-based SAP system, actions and access to data are protected by authorization objects. The authorization objects are delivered by SAP and are included in SAP systems. To provide a better overview, authorization objects are grouped into object classes.

Authorization objects allow complex checks that involve multiple conditions that allow a user to perform an action. The conditions are specified in authorization fields for the authorization objects and are linked for the check. Authorization objects and their fields have descriptive and technical names. An authorization object can include up to ten authorization fields.

The figure Authorization Roles shows an example of authorization object User Master Maintenance: User Groups (technical name: S_USER_GRP) that protects user master records. The authorization object S_USER_GRP contains two fields: Activity (technical name: ACTVT) and User Group in User Master Record (technical name: CLASS).

An authorization is always associated with exactly one authorization object and contains the value for the fields of an authorization object. An authorization is a permission to perform a certain action in the SAP system. The action is defined on the basis of the values for the individual fields of an authorization object. In the example, Authorization A for the authorization object S_USER_GRP allows creating, changing, and displaying of all user master records that are assigned to the user group SUPER. Authorization B, in contrast, allows only the display of user master records for user groups that start with A-SUPEQ and SUPERA-Z.

Multiple authorizations can be generated out of one authorization object. Some authorizations are already delivered by SAP, but the majority are created specifically for the customer's requirements.

As illustrated by the figure Authorization Check, when a user logs on to a client of an SAP system, their authorizations are loaded in the user context. The user context is in the user buffer (in the main memory) of the application server. It can be displayed using transaction SU56.

When a user calls a transaction, the system checks whether the user has the required authorization in the individual user context for calling the selected transaction. Authorization checks use the authorizations in the user context. If you assign new authorizations to the user, the user may need to log on to the SAP system again to be able to use these new authorizations (for more information, see SAP Note 452904Loss of authorization after profile generation and the documentation for the parameter auth/new_buffering).

If the authorization check for calling a transaction is successful, the system displays the initial screen of the transaction. Depending on the transaction, the user can create data or select actions. When the user completes the dialog step, the data is sent to the dispatcher, which passes it to a dialog work process for processing. Authority checks (command AUTHORITY-CHECK) that are checked during runtime in the work process are built into the coding by the ABAP developers for data and actions that are to be protected. If users have all required authorizations in their individual user context for the checks (return code = 0), the data and actions are processed and the next screen is displayed. If the required authorization is missing, the data and actions are not processed and the user receives a message that the assigned authorizations are insufficient. This is controlled by the evaluation of the return code. In this case, it is not equal to 0.

All authorizations are permissions. There are no authorizations that prohibit actions. Everything that is not explicitly allowed is forbidden. You could therefore describe this as a positive authorization concept.

Role Maintenance with Menus and Authorizations

A screenshot shows the selection of transactions using the role menu. These transactions will be linked to various PFCG roles and assigned to multiple ABAP users.

Role maintenance (transaction PFCG, formerly also called Profile Generator) simplifies the creation of authorizations and their assignment to users. As the figure Role Maintenance shows, in PFCG, transactions that belong together from the company's point of view are selected. Role maintenance automatically creates authorizations with the required field values for the authorization objects that are checked in the selected transactions.

A role can be assigned to a number of different users. Changes to a role therefore have an effect on multiple users. Users can be assigned various roles.

This image shows on the left hand side various functions like transactions, SAP Fiori Catalogs, Web Dynpros for ABAP, Web Links, and Reports, which can be included under tab Menu in transaction PFCG when editing an individual role. On the right hand part of the image, Drag&Drop is shown in the PFCG Role Menu.

As the figure Menu Layout shows, the user menu comprises the role menu(s) and contains the entries (startable applications, URLs, reports, and so on) that are assigned to the user through the roles.

To edit the menu of a role in PFCG, enter the name of the role and choose the icon for Create or Change. Choose the Menu tab page.

Here you can select and change functions: The menu tree can be adjusted for the individual roles as required.

  • You can insert startable applications such as transactions, Web Dynpo Applications or SAP Fiori objects (for example, catalogs or groups) in the tree structure and delete existing entries.

  • If you choose Report in the dropdown menu for inserting, you can also integrate reports. In this case, Role Maintenance creates transaction codes (if they do not already exist) with which the reports can be called.

  • If you choose the function Web address or file in the dropdown menu of the Insert Node button, you can add Internet addresses or links to files (such as tables or text files). When integrating files, you must use the storage paths instead of URLs. You can also specify SAP Business Warehouse web reports and links to external mail systems and Knowledge Warehouse.

  • The authorizations for SAP Fiori applications are also created using the Role Maintenance. You can maintain authorizations for SAP Fiori Catalogs, SAP Fiori Groups and starting with SAP S/4HANA 2020 also for SAP Fiori Spaces by choosing the option SAP Fiori Launchpad in the dropdown menu of the Transaction button.

Note

The content model and the authorization model are explained further in this lesson. However, new SAP Fiori Launchpad objects 'spaces' and 'pages' are not discussed in this course.

You can also change menus by creating, moving, deleting, or renaming directories and subdirectories as required. You can use the drag and drop function in role maintenance.

The first screen at the left shows tab Authorizations with a yellow color when maintaining a PFCG role and highlights the pencil pushbutton as step 1 to Change Authorization Data. It points to steps 2 and 3 as part of the 2nd screen, which shows some details when maintaining and generating authorizations profile(s) for a PFCG role.

Role Maintenanceautomatically creates the authorizations that are associated with the transactions specified in the menu tree. However, all authorization values must be manually checked and adjusted if required in accordance with the actual requirements and authorities. The system administrator is responsible for this task, together with the appropriate user department. When using organizational levels, you do not carry out maintenance directly in the field, but by means of the Organizational levels... button.

As shown in the figure Generating Authorization Profiles, you choose the Authorizations tab page and then Display Authorization Data or Change Authorization Data, depending on the maintenance mode. Check the scope and contents of the authorizations.

If there are system proposals, a green traffic light in the authorization overview indicates that Role Maintenance has supplied at least one proposal for each authorization field. A yellow traffic light indicates that the authorization must be maintained manually after it has been created. Role Maintenance does not provide a default value for the authorization. In the example shown above, which deals with user maintenance with respect to user groups, Role Maintenance offers no suggestion about which user groups should be maintained by a user that will be assigned to this role.

Some fields appear in many authorizations. A number of important fields have therefore been combined into organizational levels, such as the company code. When you maintain an entry for the organizational level using the Organizational levels... button, you maintain all the fields that appear there at the same time. A red traffic light indicates, therefore, an unmaintained organizational level.

Once all authorizations are maintained as required, the authorization profile can be generated by choosing Generate. After creation, the profile name cannot be changed. The authorizations are grouped together in profiles. The profiles must be entered in the user master record (by role maintenance) for the authorizations to take effect for the user. This is called User Comparison.

Note

The second character of the profile name must not be an underscore (_). See SAP Note 16466Customer name range for SAP objects.

After creation, the profile name cannot be changed. The authorizations are grouped together in profiles. The profiles must be entered in the user master record (by role maintenance) for the authorizations to take effect for the user. This is called User Comparison.

Users and Roles

The assignment of users to roles is performed in the Role Maintenance transaction (PFCG) or in the User Maintenance transaction (SU01). Select the User tab page and the user IDs to be maintained there. When selecting user IDs, the system uses the current date as the start of the validity period of the assignment; it sets 12/31/9999 as the end date. You can change both values.

Different single roles are assigned to single users and/or multiple users

As the figure Assigning Roles to Users shows, users can be linked to more than one role. This can be useful, for example, if some activities (such as printing) are to be permissible across roles.

The assignment of roles to users does not automatically grant the corresponding authorizations to the users. To assign the authorizations, you must first perform a user comparison, during which the role's profile is entered in the user master record. This is illustrated in the figure User Comparison.

A screenshot of transaction PFCG with the User tab and the pushbutton User Comparison is linked to a bubble called Authorization Profile. This Authorization Profile is connected to three different ABAP users.

A user comparison determines whether authorization profiles should be added to or removed from the current user on the basis of the individual role assignment. During a comparison, profiles are added to a user master record due to roles that have been added. If role assignments are removed manually or time-dependently, the corresponding authorization profiles are deleted from the user master record.

The comparison can be performed individually for each role. For this, select the role in Role Maintenance (transaction PFCG), choose the User tab page, and choose User comparison. In the dialog box that the system displays, choose Complete comparison.

If you have to update multiple role assignments, you can perform a corresponding comparison in Role Maintenance by choosing UtilitiesMass comparison (transaction PFUD). You can specify the desired roles individually, or update all assignments by entering the asterisk (*) character.

You can also activate the periodic user master record comparison in transaction PFCG by choosing UtilitiesMass comparison. Choose the option Schedule or check job for full reconciliation. The system then displays a search window for the background job PFCG_TIME_DEPENDENCY. If it does not find an appropriate job, you can create a new one. The default value is that all user master records are compared once each day.

Hint

If you want to proactively ensure that the user SAP* is no longer required for most emergency situations and that the general profile SAP_ALL no longer has to be assigned to the emergency user, see SAP Note 76829Emergency role for user administration.

Role Maintenance

Business Example

Authorizations for users are created by providing them with roles and authorization profiles. As a user administrator, you are responsible for creating roles in SAP systems.

Note

In this exercise, when the values include ##, replace the characters by the number your instructor has assigned to you.

Task 1: Copy a Role Template

You want to copy an existing SAP standard role to your own role and assign a user to it.

Steps

  1. In client 100 of your SAP system, go to Role Maintenance (transaction PFCG) and search for the single role SAP_BC_ENDUSER.

    1. Log on to client 100 in your SAP system.

    2. Start transaction PFCG.

    3. In the Role field, use the F4 value help to search for a role.

    4. In the Role Name dialog box, enter SAP_BC_ENDUSER into the Single Role field.

    5. Choose Start Search.

      Result

      A role with non-critical basis authorizations for all users has been found.
    6. In the search result list, double-click the role that has been found.

  2. Copy the SAP_BC_ENDUSER role completely to your own role Z_BC_ENDUSER_##.

    1. Back on the Role Maintenance screen, choose Copy role in the application function bar.

    2. In the dialog box that appears, enter Z_BC_ENDUSER_## in the to role field and choose Copy all.

      Result

      The SAP standard role has been copied to your custom role.
  3. Edit the role and check the transactions in the role menu.

    1. Back on the Role Maintenance screen, choose Change next to the Role field.

    2. Change the role description if required.

    3. Switch to the Menu tab page.

    4. Display the transaction codes by choosing Switch On Technical Names.

    5. Open the Basis Functions folder in the Role Menu and check which entries are included in the role menu.

      Result

      You should see transactions SU3, SU53, and web dynpro application WDHC_HELP_CENTER.
  4. Check the authorizations for the role and maintain open authorizations if necessary.

    1. Switch to the Authorizations tab page.

    2. In the Edit Authorization Data and Generate Profiles, choose Change Authorization Data.

    3. On the Change Role: Authorizations screen, expand the folder structure and check the authorizations.

      You can quickly do so by marking the folder and choosing Expand subtree.

    4. If necessary, maintain open authorizations.

      Note

      Since the applications included in the role menu are non-critical and are usually provided to all end users, only start authorization objects appear in the structure. For start authorization objects all fields are filled with values automatically and should not be maintained.
  5. Generate the authorizations profile for the role.

    1. On the Change Role: Authorizations screen, choose Generate to generate (and save) your profile settings.

    2. The system proposes an automatically generated profile name. You cannot change it. If necessary, adapt the profile description in the Text field.

    3. Choose Execute.

      Result

      The authorizations profile has been generated for the role.
    4. Choose Back to exit the Change Role: Authorizations screen.

      Hint

      You do not need to Save again, since this was already performed with the Generate function.

  6. Assign the role to the ADMIN-## user.

    1. Back on the Change Roles screen, switch to the User tab page.

      Note

      If user ADMIN-## does not exist, create a user with this user ID in transaction SU01 in a new session.
    2. Enter ADMIN-## in the User ID column.

    3. Choose Save in the bottom right-hand corner.

  7. Perform a user comparison for Z_BC_ENDUSER_## role.

    1. On the User tab page, choose User Comparison.

    2. Choose Full comparison.

    3. After the comparison has been completed, choose Cancel to close the dialog box.

      Result

      You can see the green traffic light for the user comparison. This means that the user master record has been fully compared with the role and the authorization profile has been assigned to the user.
  8. Check if user ADMIN-## has received the authorizations.

    1. Log on to client 100 of your training SAP system with user ID ADMIN-## and the production password you have set in the previous exercise.

      On the SAP Easy Access screen, you should see that user ADMIN-## has a user menu assigned.

    2. Start the transaction SU3 and SU53. Are you authorized to do so?

      Result

      User ADMIN-## has the authorizations to execute the transactions.

Task 2: Create Your Own Role

Instead of copying the SAP standard role, you want to create a custom role . Create a single role MONITORING_## to authorize SAP transactions.

Steps

  1. In Role Maintenance (transaction PFCG), create single role MONITORING_##.

    1. Log on to client 100 of your assigned training SAP system.

    2. Start transaction PFCG.

    3. In the Role field, enter MONITORING_##.

    4. Choose Create Single Role.

    5. Enter a suitable description in the Description field.

    6. Choose Save in the bottom right-hand corner.

  2. Create a role menu with transactions SM50, SM51, SM04, and SU01 included.

    1. Switch to the Menu tab page.

    2. Choose Insert NodeTransaction.

    3. In the Assign Transactions dialog box, enter the following transaction codes:

      Transactions

      Transaction codeText
      SM50Work Processes of AS Instance
      SM51Started AS Instances
      SM04Logons to an AS Instance
      SU01User Maintenance
    4. Choose Assign Transactions.

    5. Choose Save in the bottom right-hand corner.

  3. Maintain authorizations for the role MONITORING_##. Provide the authorizations for administering user group ADMINTEAM_## by editing authorization object S_USER_GRP.

    1. Switch to the Authorizations tab.

    2. In the Edit Authorization Data and Generate Profiles, choose Change Authorization Data.

    3. In the Define Organizational Levels dialog window, choose Full authorization.

      Note

      In this exercise, this is done only for simplicity reasons. Normally, you would provide single authorizations for the organizational levels defined in your company.
    4. Choose Save.

    5. On the Change Role: Authorizations screen, expand the folder Object Class BC_A.

    6. Expand the S_USER_GRP authorization object.

    7. Expand the generated authorization.

      Result

      You can see that the ACTVT field is already maintained. However, you need to enter values into the CLASS field.
    8. Maintain field CLASS by choosing Change.

    9. As field value select ADMINTEAM_## using F4 value help.

    10. Choose Transfer.

    11. Maintain field ACTVT by choosing Change.

    12. Deselect all activities except of Display.

    13. Choose Transfer.

    14. Maintain other open authorizations.

      For example, you may choose the Status button with the red traffic light at the top and confirm the system query about assigning full authorization by choosing Execute.

      Note

      In this exercise, only for the sake of simplicity you should assign full authorizations. In "real life", you should adapt the single authorizations quite carefully.
  4. Generate the authorizations profile for the role.

    1. On the Change Role: Authorizations screen, choose Generate to generate (and save) your profile settings.

    2. The system proposes an automatically generated profile name. You cannot change it. If necessary, adapt the profile description in the Text field.

    3. Choose Execute.

      Result

      The authorizations profile has been generated for the role.
    4. Choose Back to exit the Change Role: Authorizations screen.

      Hint

      You do not need to Save again, since this was already performed with the Generate function.

  5. Assign the role MONITORING_## to the user ADMIN-## in the user maintenance (transaction SU01).

    1. Start transaction SU01.

    2. On the initial screen, look for the user master record of the ADMIN-## and open it in the edit mode by choosing Change.

      Note

      If user ADMIN-## does not exist, create a user with this user ID in transaction SU01 in a new session.
    3. Switch to the Roles tab.

    4. In the Role column, add the MONITORING_## role. If necessary, use the F4 value help to find it.

    5. Choose Save in the bottom right-hand corner.

      Result

      If you assign the role to the user in the user master record in SU01, the user comparison is performed automatically.
  6. Check if user ADMIN-## has received the authorizations of the new role MONITORING_##.

    1. Log on to client 100 of your training SAP system with user ID ADMIN-## and the production password you have set in the previous exercise.

    2. Start the transaction SU01.

  7. Try to change the user master record of TRAIN-## user who you assigned to the ADMINTEAM_## user group in the previous exercise. Are you able to do that?

    1. On the initial screen, look for the user master record of the TRAIN-## and open it in the edit mode by choosing Change.

      Result

      User ADMIN-## is not authorized to change user TRAIN-## because the user is assigned to user group ADMINTEAM_##. The ADMIN-## user only has display authorizations.

Log in to track your progress & complete quizzes