Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Sesh_Sreenivas
Advisor
Advisor
Breaking the silos in any business and achieving a 'true' digital transformation is not an overnight process. Some tools help the organizations with it - SAP Workflow Management and SAP Intelligent Robotic Process Automation (SAP Intelligent RPA) has been a core part of the digital transformation strategies and to increase workforce productivity & efficiency. In this blog, I will explain in detail why and how we can integrate SAP Workflow Management and SAP Intelligent RPA.

BPM, as a technology, deals with identifying and reengineering processes to eradicate bottlenecks and optimize the business process for maximum efficiency. With long-term involvement, one can achieve an increase in productivity, agility, efficiency & compliance with reduced cost. RPA deals with automating, repetitive manual activities that do not require complex decision making. It can work on any existing systems in a non-disruptive manner, and one can quickly realize the returns; however, the implementations may not address the underlying process inefficiencies.

SAP Workflow Management is a family of services to manage workflows, business rules for decision logic, and gain end-to-end process visibility. While the SAP Cloud Platform Workflow automates structured processes, the SAP Intelligent RPA helps run repetitive, rule-based, and user interface-focused tasks.

For a use case of new customer onboarding in a bank:

  1. A request from a prospect received as an email or submitted at the bank's website, or a visit to a bank's branch is handled by an SAP Intelligent RPA bot.

  2. The bot process the available data and triggers the "Customer Onboarding" workflow in SAP Cloud Platform Workflow (handshake 1).

  3. The bank clerk identifies the hot leads, and the workflow automatically calls an unattended RPA bot to execute the mandatory KYC checks for the new customer (handshake 2).

  4. After receiving the KYC details from the bot (handshake 3), the workflow assigns a task to the bank clerk, who then approves the customer.

  5. Then the workflow automatically creates a bank account and manages to provision for the checkbook, credit card, web, mobile app access, and automatically send a confirmation email to the new customer.




In this scenario, there are three handshakes between the SAP Cloud Platform workflow and the SAP Intelligent RPA bot:

  1. Bot starting a new workflow.

  2. Workflow triggering a bot and waiting for a response

  3. The bot gives the control back to the workflow from where it was triggered.


Continue to read if you want to know how to achieve these handshakes.

Scenario 1: Start a new workflow from SAP Intelligent RPA bot


To start a new workflow in the SAP Cloud Platform, one can call the SAP Cloud Platform Workflow REST API from the RPA bot. Refer to the help documentation and API guide for more details (use the entity Workflow Instances and POST method). The API requires the request body in the following format:
{
"definitionId": "<workflow definition id>",
"context": {
<context in JSON format>
}
}

For authentication, you can use any supported authentication, for example, OAuth 2.0 client credentials flow.

Scenario 2: Trigger the SAP Intelligent RPA bot from SAP Cloud Platform Workflow


To trigger the SAP Intelligent RPA bot from SAP Cloud Platform Workflow, you need to

  • Enable appropriate inputs for the bot.

  • Create an API trigger to the RPA bot.

  • Configure the workflow to trigger the bot API.


API Trigger


To understand how to create input and expose the bot as API, you can refer to the help document.


Service Task Configuration in SAP Cloud Platform Workflow


Once the API trigger is available, you can call it directly from the SAP Cloud Platform Workflow Service Task. To trigger an RPA bot by API, you need to provide the input & invocation context. The data required for bot execution should be passed as the input (for example, customer details). For the invocation context, you can pass transactional data (like workflow definition ID, the business key of the workflow instance, and message definition ID) that is not relevant for the bot execution but can be used later to pass the result back to the workflow.


Asynchronous RPA execution & Intermediate Message Event


The RPA bot execution is asynchronous - you do not get a response immediately, but only after the bot completes the execution. If it is not a fire-and-forget use case, you want the workflow to wait until it receives a response from the bot before proceeding to the next steps. In such a case, you can add an intermediate message event right next to the service task in the workflow. When you add such an event, the workflow waits for RPA bot to call a REST API for the confirmation. The messages received through this endpoint are correlated to workflow instances based on the business key (how to set business key), workflow definition ID, and the intermediate message definition ID. If the workflow engine can correlate it with an instance that is waiting at an intermediate message event, then the workflow moves to the next steps.



 

Authentication


The authorization token and irpa-trigger-token authenticate the bot API trigger. The API URL and the authorization token can be part of the destination created in the SAP Cloud Platform. The SAP Cloud Platform Workflow (as of March 2020) does not support modifying HTTP headers, and you can pass the irpa-trigger-token along with the input and invocation context as irpaTriggerToken

A sample body for the API trigger looks like:
{ 
"irpaTriggerToken": "9812873abcd779823",
"invocationContext": {
"key": "2122013",
"workflowDefID": "bankaccountopening",
"messageDefID": "messageFromRPA",
},
"input": {
"Customer": {
"StreetName": "Some Street",
"CountryOfResidence": "Germany",
"DateOfBirth": "13/July/1985",
"HouseNumber": "2805",
"Email": "email@email.com",
"FirstName": "Sarah",
"ZipCode": "69190",
"CertificateOfResidence": "https://shared.doc/SarahM2122013",
"City": "AnyCity",
"Nationality": "German",
"MaritalStatus": "Married",
"LastName": "Meyer",
"Country": "Germany",
"JobSituation": "Salaried",
"PassportNumber": "2122013"
}
}
}

Note: There are no specific message formats for the invocation context and hence you can give any names for the attributes key, workflowDefID & messageDefID. However, the values need to be the business key, workflow definition ID & the message name of the intermediate message event respectively.

Scenario 3: RPA bot shares the execution result back to the workflow


If you need to share the bot execution result back to the workflow from where it was triggered, then as a pre-requisite, you should have defined an intermediate message event in the workflow model (as discussed earlier). At the end of bot execution, you could call the SAP Cloud Platform Workflow REST API to confirm the message either as a step in the RPA bot or API notifier of the RPA bot, depending on the use case.

The SAP Cloud Platform Workflow Messages API requires the request body in the following format:
{
"context": { <result of bot execution in JSON format> },
"definitionId": "string",
"workflowDefinitionId": "string",
"businessKey": "string"
}

On successful bot execution, you can pass the output of the bot execution to the context node, and for the definitionIdworkflowDefinitionId & businessKey, you could use the information available in the attribute invocationContext that we passed earlier when calling the RPA bot from the workflow. For authentication, you could use the OAuth 2.0 client credentials flow.



 

Conclusion


Although SAP Workflow Management and SAP Intelligent RPA are unique in their own way, they complement each other because they have similar goals - increase process efficiency & employee productivity. If you deploy them together, they present you with a powerful platform to facilitate digital transformation throughout your organization. You can further read the blog from singh.simar to understand the data flow between input & output for API triggers and notifiers.
3 Comments