SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Provide Authorizations to Users for non-Released Authorization Objects checked by the "Create Purchase Requisition" function module

Learn how to provide a user with authorizations for your wrapper-enhanced RAP BO for both CHECK and DO NOT CHECK options.

Overview

🎓 intermediate 15 min. ABAP ExtensibilityIntermediateSAP S 4hanaABAP Development

You will learn

  • How to find out the needed authorization objects for a given BAPI
  • How to handle authorizations via an authorization default variant for the check authorization use case
  • How to suppress all authorization checks in the disable authorization check use case

Prerequisites

Prerequisites

  • You have completed the previous tutorial in this group and integrated your wrapper in your RAP BO.
  • You will be using the same user with full development authorization you used in the previous tutorial of this group. Throughout the tutorial, we will refer to this user as ‘developer user’ or ‘user with unrestricted access’, to distinguish it from other users we will create as part of the tutorial.

Steps

Intro

Throughout this tutorial, wherever ### appears, use a number (e.g. 000). This tutorial is done with the placeholder 000.

In the previous tutorials of this group we used a user with full development authorization to be able to develop the RAP BO and the wrapper. Given the unrestricted access that this user has, we did not have to worry about providing authorizations so far. In this tutorial we want to test two different authorization scenarios: the case in which we want authorizations to be checked upon the creation of a purchase requisition (so that only authorized users can perform this action), and the case in which we do not want any authorization check to be performed.

In a realistic scenario, the next step would be to develop a UI for your application, deploy it to your system, and maintain all the needed objects (i.e.: Business Catalogs, Business Roles, etc). However, in this tutorial we will follow a simplified approach and we will test the various authorization scenarios via the application preview available in ADT, without the need for UI development and deployment. For this reason, we need a user which is allowed to access the application preview via ADT: we create this user in the next step.

Step 1 Provide user with restricted role for preview testing

In this tutorial we want to test different authorization scenarios via the application preview, and therefore we need a user with restricted access. You will now create such a user, which we will refer to as ‘shopping cart user’.

Logon on to your SAP S/4HANA system via the backend, using your developer user credentials and create a new user (transaction SU01) with name Z_USER_###.

Create user
Create user

Now, you will need to create a role for this user to be able to access the ADT and get the URL of any service binding preview.

Start transaction PFCG and create a new role as a copy of the SAP_BC_ABAP_DEVELOPER_5 role template, according to Set Up Developer Extensibility documentation. This role is needed for preview testing. Input the template role name and click on the Copy Role icon:

Create developer 5 role
Create developer 5 role

We suggest to name the role ZAP_BC_ABAP_DEVELOPER_5_###. Click on Copy all:

Create developer 5 role - name
Create developer 5 role - name

Open the newly created role in edit mode, navigate to the Authorizations tab and click on Change Authorization Data. Click on the Status button (1) and confirm the pop-up to give the role full authorizations (2). Then Save it (3) and click on the Generate icon to generate the authorization profile (4) (confirm the pop-up window).

Create developer 5 role - authorizations
Create developer 5 role - authorizations

Then go back, navigate to the User tab and add the Z_USER_### (1), Save (2) and click on the User Comparison button (3) (select Full Comparison in the pop-up window):

Create developer 5 role - user
Create developer 5 role - user

This role allows the user to access ADT and get the URL of any service binding preview. However, the user still lacks access to the actual service binding (i.e: it cannot use the application preview). This will be addressed in the next step.

Step 2 Check authorization use case - Test user access with restricted authorizations
+
Step 3 Check authorization use case - create authorization default variant
+
Step 4 Check authorization use case - Maintain authorization defaults for the wrapper in default variant
+
Step 5 Check authorization use case - add authorization default variant to the role
+
Step 6 Disable authorization check use case
+
Step 7 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Provide user with restricted role for preview testing 2. Check authorization use case - Test user access with restricted authorizations 3. Check authorization use case - create authorization default variant 4. Check authorization use case - Maintain authorization defaults for the wrapper in default variant 5. Check authorization use case - add authorization default variant to the role 6. Disable authorization check use case 7. Test yourself

Learn more →