Skip to Content
Technical Articles
Author's profile photo Cylia Oulebsir

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”.





Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Djamel Baraka
      Djamel Baraka

      Hi Cylia,

      Thank you for the great post, I find it really helpful.


      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you 🙂

      Author's profile photo Abir Cherif
      Abir Cherif

      Hi Cylia,

      Thanks for the nice blog post, very clear and helpful.

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you Abir 🙂

      Author's profile photo yassine NAIT BEN MOUS
      yassine NAIT BEN MOUS

      Hi Cylia,

      nice blog .


      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thanks you 🙂

      Author's profile photo Mor LOUM
      Mor LOUM

      Hi Cylia,

      Thank you for sharing with us this amazing post.


      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you Mor 🙂

      Author's profile photo Nizar BETTAIEB
      Nizar BETTAIEB

      Hi Cylia,

      Great Job!

      Thanks for sharing.


      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you Nizar 🙂

      Author's profile photo Khaled Zougagh
      Khaled Zougagh

      Hi Cylia,


      Great job, thanks for your nice blog.

      Very clear and helpful.

      Author's profile photo ADIMAT Jean-Louis
      ADIMAT Jean-Louis

      Very interesting. Thank you

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you Jean-Louis 🙂

      Author's profile photo Walid LAMKIMEL
      Walid LAMKIMEL

      Hi Cylia

      Great Job, Thanks for sharing.

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you Walid 🙂

      Author's profile photo Jean-Michel SALLENDRE
      Jean-Michel SALLENDRE

      Merci pour le partage

      Author's profile photo STERIA TMA IRD

      Hi Thanks to share this blog

      Author's profile photo Femi Hassan
      Femi Hassan

      Really interesting concept, thanks for sharing.

      Author's profile photo Naoufel EL KHAYATI
      Naoufel EL KHAYATI

      Good job Cylia 🙂

      Author's profile photo Hanane BARKA
      Hanane BARKA

      Nice blog .

      Author's profile photo MEUNIER Hanen
      MEUNIER Hanen


      Thanks for sharing !

      Author's profile photo Paul Sukanta
      Paul Sukanta

      Hi Cylia

      Bravo!!!, great Job, thanks for sharing.

      Author's profile photo Elhem CHRIAA
      Elhem CHRIAA

      Nice blog Cylia. Thank you for sharing.

      Author's profile photo Alexandre Legros
      Alexandre Legros

      Another very interesting article, thank you Cylia.

      Author's profile photo Marie TAILLET
      Marie TAILLET

      Very interesting ! Thank you Cylia

      Author's profile photo Jefferson Misiak
      Jefferson Misiak

      Hello Cylia,
      Great job, thanks for your nice blog.

      Muito legal 🙂

      Author's profile photo Diogo Coimbra de Brito
      Diogo Coimbra de Brito

      Hi Cylia,

      Thanks for sharing, congratulations!

      Author's profile photo Uday Kumar
      Uday Kumar

      Nice blog..Keep up the good work

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you 🙂

      Author's profile photo Jaroslav Liska
      Jaroslav Liska

      Perfect, this helped a lot. Although I have one question. I am using similar scenario to download mail data to excel (attachments, subject, sender, sent date). I need to have this data in columns. The issue I have is that there could be x attachments but only one subject, sender, sent date. How can I make it work in order to have it in same excel rows in case when e-mail has more attachments? Either to have lines in case of more attachments empty, or with same values? I was not able to save list of attachments with Set Cell (values) probably as it could be a list, so for attachments I used push values. For rest (subject, sender, date) I am using set cell with index number.



      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Hi Jaroslav,

      What I suggest is to add a control (condition) on the date, sender or subject


      if ( = step.index - 1) we stay on the same line

      hope this will be helpful 🙂

      Author's profile photo Jaroslav Liska
      Jaroslav Liska

      Hi Cylia, thank you, but could you please be more specific?

      This is what I currently have.maildata

      Thank you.


      Author's profile photo Jaroslav Liska
      Jaroslav Liska

      Another approach I tried is to create number from mail attachment list as variable and use this variable somehow. First thing that came to my mind was repeat function but this does not work as expected as the following set cell takes index of current run so it overwrites the same cell. What am I missing? 🙁