Automating Business Process with SAP iRPA and python
Being an SAP technical person, I got an opportunity to work on python, and then an idea came to me to combine SAP iRPA and python together to automate a process.
Here, I am going to share the process overview of a simple use case.
- Microsoft Outlook
- Prior knowledge of python and SAP iRPA
- Desktop Studio 22.214.171.124
The capability of SAP iRPA bots are vast; they can be integrated with other powerful languages like python, and it can harness its power to achieve various complex scenarios.
We would take a very simple process of Bank creation from a user initiated email, and convert it into an automated bot transaction.
Our key players are:
Hanna – a German user working in SAP Banking and Finance domain
Ganesh – Hanna’s Indian counterpart to help her with all the technical needs
SAP iRPA bot
Hanna wants to create a Bank in SAP system. So she sends an email to Ganesh, with all the required details as a PDF attachment. But she sent the details in German language! Ganesh is Indian supervisor, who would help Hanna in creating the Bank in SAP system. But Ganesh does not know German language!!
Now Ganesh has to take either of the following options:
- Take help of someone who knows German language, or to find out all the details on his own with the help of third party translator tools; and keep Hanna waiting all that time.
- Execute an SAP iRPA bot built for this specific purpose, and give an update to Hanna in just few seconds.
As Bank creation is a very important part of SAP Banking and Finance, so Ganesh opted for the second option to execute the iRPA bot.
Process after inclusion of iRPA bot:
Architecture of the bot:
The bot would perform below steps:
- Search Emails
- Save the required attachments
- Perform OCR extraction
- Translate the email attachment into user preferred language
- Convert it into an SAP iRPA understandable format
- Logon to SAP and perform rest of the operations
Designing the bot:
The bot has 3 component in it:
- Outlook integration for Emails
- Python call to take care of the attachments
- Logon to SAP ECC to perform rest of the operations
Step 1: Create a Workflow
- In SAP iRPA Desktop Studio, create a new project.
- Open the “Workflow” perspective, and create a new workflow.
Step 2: Add Outlook Integration scripts
- Go to the “Scripts” perspective
- Add “Outlook Integration”
- Add “SAP GUI Scripting”
- Click on Save
Step 3: Enhance the generated code with custom logic
For this step, we have to build the project. Once the project is built, we can add our custom logic to search and save attachments from Outlook.
- First we need to initialize the outlook library and reset the email collection.
- Then, we can build our custom search criteria.
Step 4: Call python to take care of the attachments:
As we have already built our project in the previous step; we can enhance the custom code to include the python script.
- We will be performing the PDF handling operations in this python script.
- The python script is parameterized to define the source and target directories, as well as, the source and target languages; so that the script can perform the translations as well and conversion to SAP iRPA understandable data format.
Step 5: Logon to SAP ECC:
For rest of the operations, we have to capture the SAP pages one by one and add the desired operations onto them.
Capturing SAP Logon
- Click on “+ Add Application”
- Select UIAutomation as technology
- Click on “SAP Logon 7xx”
- Click on “Save And Capture Page”.
- On the next pop-up we can now capture the screen of the SAP Logon application.
- Next, we have to select the desired system name, and add it to our step.
- Repeat the above steps and build the application.
After completing all the captures, save and build the project again.
Once the build is complete, logon to SAP Cloud Foundry account, and start iRPA service.
From Desktop Studio, when the “Debug/F5” is clicked, Desktop Agent gets invoked.
Right click on the Desktop Agent, and click on your workflow; the bot would take care of rest of the things, and it would take just couple of seconds to finish the whole operation.
This blog post should give an overview of the usage of ‘Outlook Integration’; python scripting; transferring data between python and SAP iRPA; capture pages with different techniques (UIAutomation and SAPGUI connector); workflow and script perspectives and execute the process with the Desktop Agent.