Technical Articles
SAP RPA 2.0 Challenge Submission: Automate SAP ECC Authorization roll-out
Introduction
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:
- Create Excel automation
- Capture SAPGUI application
- Create SAPGUI access automation
- Create Role automation
- 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
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
Step5: Global automation
And as a last step, we will create an automation that gathers all the automation created previously
Conclusions:
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”.
Hi Cylia,
Thank you for the great post, I find it really helpful.
Thanks.
Thank you 🙂
Hi Cylia,
Thanks for the nice blog post, very clear and helpful.
Thank you Abir 🙂
Hi Cylia,
nice blog .
Thanks.
Thanks you 🙂
Hi Cylia,
Thank you for sharing with us this amazing post.
Congratulations!!
Thank you Mor 🙂
Hi Cylia,
Great Job!
Thanks for sharing.
Thank you Nizar 🙂
Hi Cylia,
Great job, thanks for your nice blog.
Very clear and helpful.
Very interesting. Thank you
Thank you Jean-Louis 🙂
Hi Cylia
Great Job, Thanks for sharing.
Thank you Walid 🙂
Merci pour le partage
Hi Thanks to share this blog
Really interesting concept, thanks for sharing.
Good job Cylia 🙂
Nice blog .
Interesting
Thanks for sharing !
Hi Cylia
Bravo!!!, great Job, thanks for sharing.
Nice blog Cylia. Thank you for sharing.
Another very interesting article, thank you Cylia.
Very interesting ! Thank you Cylia
Hello Cylia,
Great job, thanks for your nice blog.
Muito legal 🙂
Hi Cylia,
Thanks for sharing, congratulations!
Nice blog..Keep up the good work
Thank you 🙂
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.
maildata
Hi Jaroslav,
What I suggest is to add a control (condition) on the date, sender or subject
Example:
if (step.currentMember.date = step.index - 1) we stay on the same line
hope this will be helpful 🙂
Hi Cylia, thank you, but could you please be more specific?
This is what I currently have.
Thank you.
maildata
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? 🙁
maildata2