Skip to Content
Technical Articles

Automating Business Process with SAP iRPA and python

Hello Everyone,

 

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.

Prerequisites:

  • Microsoft Outlook
  • Prior knowledge of python and SAP iRPA
  • Desktop Studio 1.0.5.57

Background:

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.

 

Business Story:

We would take a very simple process of Bank creation from a user initiated email, and convert it into an automated bot transaction.

Key players:

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

As-is process:

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:

  1. Outlook integration for Emails
  2. Python call to take care of the attachments
  3. 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.

Conclusion:

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.

Happy Learning!!!

2 Comments
You must be Logged on to comment or reply to a post.
  • Why do we need a person to execute the bot? Hanna should request via service ticket, email, chat (slack/teams) or CAI and the bot can execute and feedback in real time.

    Ganesh can move on to do higher value work or code exceptions / train the bot  and keep making it better and better.

    • Hi Devraj,

      Thank you for mentioning.

      This is just a beginning process where the idea is to just automate a basic process.

      In real time scenario as you are mentioning, the bot would not reside locally, and would be integrated to other third party systems as you mentioned.