Skip to Content
Technical Articles

SAP RPA 2.0 Challenge Submission: Automate SAP ECC Authorization roll-out


This blog is a part of the SAPRPA2.0_TutorialChallenge2021, we will show you how you can use iRPA to automate your authorization roll-out.

Our case:

One of the most important topic within SAP implementation project is Security, designing and implementing Authorization matrix is often a critical mission, and especially for wide roll-out project with multiple organization level.

Based on authorization concepts like Master roles, derived roles and composite roles, our robot will automate and secure the creation and assignment process of roles.

This optimizes and facilitates the daily work of system administrators and IT teams.

Main Steps:

  1. Create Excel automation
  2. Capture SAPGUI application
  3. Create SAPGUI access automation
  4. Create Role automation
  5. Create Global Automation

Step1: Create Excel automation

We will use an excel file, where we store the list of roles to create, before starting creation, we must first generate the role name which will be the concatenation of the pre-role and Purchasing Organization column and store the result in the column “derived role” for each line.

In the cloud studio on the left, we have to select create => Automation

When we creating our first automation in a project, we will be asked to choose the agent version:

So we choose our agent which is already connected to the tenant witch is “Local Agent”

Select the Agent and confirm

Here we need to choose the name of our automation -> Create

When we create the automation, automatically we import the 2 default SDKs (irpa_core, irpa_excel), those SDKs contain the different activities to manipulate an automation or an excel file, so we have to make sure that we have this 2 dependency.

First, what we have to do is to open the excel file, we drop and drag “Open Excel Instance” activity.

To extract data from the excel we need to add “Excel Cloud Link” activity,

double click on it -> Browse -> We have to choose the excel file to work on it

Here we can see than he detected the excel range where the data coming from

To use correctly data coming from excel, we need to create a new data type directly from this activity, and choose the name, with is Role List in our case, and click “Create”

Set “Output parameter” 

This data contain all the data coming from the excel file

The activity “Excel cloud Link” will close the excel file, and we will need to reopen it to put new data, so we drop and drag “Open Webhook” activity and set the path of the file

Select the worksheet Name where we want work on it

Now, what we need to do is to loop for each line of excel file, we have to add ”For each” control to read each line in our excel file

Then we define the loop list which is “RoleList” output parameter

We have to set cell Value and the definition of the range of cell in the excel File where we need to set the value (H in our case)

Roles will be generated from the 2nd line (H2, H3, H4, …) to indicate the right range definition where to set the new value, we will concatenate the column with the row number, so we have to build the expression, we put the new value inside the column ‘H’ and specify the number of the line:  the expression ‘H;’ + (Step5.index + 2) (index starts from zero)

The result will be the concatenation of the content of the 2 columns: pre-role and purchasing organization separated by underscore

Test Result in debugger

In order to retrieve the result of this automation which is the list of roles generators, we must specify the result as an output parameter


Step2: Capturing SAP GUI application

Before we can capture an SAP GUI application, we need to perform the following steps:

  • Check if Scripting is enabled
  • Uncheck “Notify when a script attaches to SAP GUI”
  • Uncheck “Notify when a script opens a connection
Enable server-side scripting

Open transaction RZ11 -> sapgui/user_scripting -> Display

Set “Current Value” to True

Note: we have to open SAP Logon in our system before we start capturing the application

Select Application from the Create menu

Click on SAP Logon, we will get a preview of the already open application -> Click Capture

Select an element to declare -> click the Declare Element button

That will add the element as an item in the left-side panel

We have to do the same for all the screens and elements which we must pass in order to proceed to the creation of roles and authorizations

Step3: Automate an SAP GUI application

The next step will be to create an automation, we will split into 2 sub-automations, one to connect to sapgui and access the ‘PFCG’ transaction, the other for roles creation

SAPLogon access automation

Then, we will drag and drop the already declared pages in the automation sequence

To set the connection data, we will use the “Set Element” activity

Drag and drop “Start Transaction” activity and fill the transaction code ‘PFCG’

Step4: Create Automation: Create Role

Before starting and since we will be based on the list of roles that are in the excel file, we must first pass this list in the input parameters

We select RoleList and check the box “Liste”

We drop and drag “For Each” control and define objects list wich is the input parameter RoleList

In this step we must specify the role by adding the activity “Set Element” which will have as value: “Step1.currentMember.delivredRole” and “Click” activity to create role

Here we must give the description Step1.currentMember.description, and the derived role : Step1.currentMember.delivredRole

In this step we just have to follow the steps which allow to create a role and generate the authorizations by adding the “Click” activity for each button

Then we add the screen “Save Role” and set “Click” activity on “Yes” Button

Here we have added the “Define Organizational Level” screen and fill in the fields with their respective data

Then we go to the step to generate the profile by adding a click for the generate button

Step5: Global automation

And as a last step, we will create an automation that gathers all the automation created previously



During this blog, we have shared with you, how you can prepare your Excel source files, automate SAP Gui connection and automate SAP ERP Transaction execution using iRPA. Please share with us your feedback and comments, and feel free to get in touch with us for further details.

Do not hesitate to support us with your “like”.





You must be Logged on to comment or reply to a post.