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: 
YatseaLi
Product and Topic Expert
Product and Topic Expert
The pursuit of Efficiency improvement is one of main objectives for a modern company since the invention of Scientific Management by Frederick Winslow Taylor, especially on the labor productivity increase through analysis and synthesis of workflow, standardization of best practices etc during the second industrialization era, also well known as Taylorism. A scene of Production Automation with machinery in factory is well illustrated in movie Modern Times starred by Charlie Chaplin.


With the development of modern Scientific Management after World War II, and the invention of modern computer, computer-based management software becomes the "central nerve system" of a business, centrally planing the business activities, execution monitoring, managing and coordinating all the resources within and even beyond the company, which has taken the practices of scientific management for efficiency yield to the next level.

The customers, suppliers, employees, materials/products etc of a company in real-world are reflected as some system records of master data, and the interaction and exchange between customer, supplier, and other parties are mapped as the transactional records of system. A set of related activities or tasks are grouped and structured to form a business process, such as Order-to-Cash process. Its information flow is made up of

  • Data entry of system record representing the states of the process, such as a record of sales quote has been entered into system by the sales representative or sales assistant, which indicates the early state of order-to-cash process where customer seems interested on the company's product or service, and request for a quote, now the sale representative has responded with a sales quote to the customer.

  • User tasks recording human intervention in the process, such as an exception of price condition in the sales quote triggers an approval request to sales manager, where sales manager needs to make a decision to approve or not.

  • Notification of state change about the process to human agent for communication and collaboration, such as the sales representative receives an internal system message once the sales quote is approved, and whist, the sales quote is automatically emailed to the customer.


Any manual activity in a sequential process will potentially slow down the whole process, any error by human may lead to economic loss or efficiency deficit.

Therefore, Process Automation is key to improve operation efficiency by reducing the repetitive manual processes, and eliminating the human error. Especially, with the recent years' technological advance on AI/ML, IoT etc intelligent technologies. Robotic Process Automation is fueled with intelligence, where we have SAP Intelligent Robotic Process Automation to create, schedule, manage, and monitor intelligent bots for business process automation.

On the other hand, Process Orchestration is crucial to achieve business agility, process flexibility and process visibility by connecting and orchestrating business activities, user tasks and communication/collaboration, where SAP Workflow comes into place.

Phew, what a lengthy opening! I am not here to discuss scientific management, but to share my exploration of SAP Workflow Service and SAP Intelligent RPA, seeing how we can put together process orchestration and process automation to achieve business agility and operation efficiency in one shot. In addition, the scenarios of synergy & integration between SAP Workflow Service and SAP Intelligent RPA have been well explained in the blog post about The synergy & integration between SAP Intelligent BPM and SAP Intelligent RPA by seshadri.sreenivasr, which is really an informative and worthy read.

The objective of this blog post is not to discuss the design of an SAP Intelligent RPA Bot. Instead, it aims to show how easy to implement a predefined bot by SAP, and how you can extend it with SAP Workflow.

 

Sample Scenario - Automation of Mass Maintenance of Sales Prices in SAP S4/HANA or SAP S4/HANA Cloud


Let's start the story with John, a sales assistant of Amika, one of John's responsibility is to maintain the sales prices of the products in their ERP system SAP S4/HANA Cloud.  Hundreds of sales price are manually entered into the system by John, which usually take John a few days, and it is error-prone in such a repetitive manual task. The company have recently implemented SAP Intelligent RPA to automate their manual process. Fortunately, Mass Maintenance of Sales Price is available as the a predefined scenario  SAP Intelligent Robotic Process Store, which the partner can help to implement it and go live easily by following its configuration guide.

Here you have the video how to configure the mass maintenance of sales prices bot for SAP  S4/HANA Cloud.



Now with in place of SAP Intelligent RPA, what john needs to do is to prepare the Sales Prices in the predefined excel template, then he can trigger the process automation in attended mode or with a schedule job in unattended mode. As a result, the entire process of sales prices maintenance is significantly reduced with process automation.

Here you can see how John can run the bot to automate the process of creating and updating the price conditions.



However, the sales manager Janet would like to have some visibility of the the process, which the sales prices list should be reviewed and approved in prior to data entry with the automation, assuring the sales prices are correctly maintained.

As a partner, you could have two options to achieve so by orchestrating the process automation by SAP Intelligent RPA Bots with SAP Workflow

  • Option 1: (Covered in this blog post)How to enhance a predefined SAP Intelligent RPA bot about mass maintenance of sales prices in SAP S4/HANA Cloud by adding an approval request for reviewing and approving the changes of sales prices condition in prior of the automation. Exactly the same approach as Scenario 2: Trigger the SAP Intelligent RPA bot from SAP Cloud Platform Workflow in Seshadri's blog post mentioned above.

  • Option 2: (Covered in a separated blog post) How to achieve the same scenario with the built-in process orchestration capability of the SAP Intelligent RPA 2.0 Cloud Studio with automation, user task, and process.


Option 1: Orchestrating the SAP Intelligent RPA Bots explicitly with SAP Workflow Service through API trigger


Given a SAP Intelligent RPA Bot could be triggered through API, and SAP Workflow Service can fire an http request with a Service Task, therefore, we can explicitly invoke and orchestrate an SAP Intelligent RPA bot with a Service Task in SAP Workflow Service. You may refer to Seshadri's blog post for a detailed explanation.

Prerequisites:



  • You have gone through this Tutorial to Get Started with SAP Workflow Service

  • An API trigger to the Bot has been added for the package Mass Maintenance of Sales Prices in an Environment.


 

Basis of extending and orchestrating an SAP Intelligent RPA Bot with SAP Workflow Service.


Here you have video to explain the detail about how to extend an SAP Intelligent RPA Bot with SAP Workflow Service by adding email notification, user task for approval and service task to trigger the bot through API.



 

The overall workflow design of sales_price_workflow as


 

An sample of a workflow instance of workflow sales_prices_workflow through REST API, which you can refer to api.sap.com for more detail.
{
"definitionId": "sales_prices_workflow",
"context": {
"salesPrices": {
"requestBy": "yatsea@sap.com",
"requestAt": "2021-03-23T03:10:57.523Z",
"approveBy": "yatsea@sap.com",
"approvalStatus": "New",
"excelBaseFolder": "C:\\temp\\MaintainSalesPrices\\Excel",
"remarks": "Special prices for Account 10100001",
"approvalRemarks": ""
}
}
}

 

The custom attributes of the workflow, which are used to store the additional information about the approval.

  • approvalStatus:      ${context.salesPrices.approvalStatus}

  • appvovalRemarks: ${context.salesPrices.approvalRemarks}



 

Now, let's have a close look at the workflow design step by step.

Step 1: New Approval Email Notification to the approver



This is an mail task to notify the approver for new approval request.

Please refer to this online help about Configure the Workflow Service Mail Destination
The configurations of the new approval email notification
To: ${context.salesPrices.approveBy}
Subject: Approval required for Mass Maintenance of Sales Price by SAP Intelligent RPA
Plain Text Body:
Dear ${context.salesPrices.approveBy},

There is a new request pending for your approval.
Request By: ${context.salesPrices.requestBy}
Request At: ${context.salesPrices.requestAt}
Sales Prices Excel Base Folder: ${context.salesPrices.excelBaseFolder}
Request Remarks: ${context.salesPrices.remarks}

Please review and take action via My Inbox of SAP Workflow Service.
https://******.cockpit.workflowmanagement.cfapps.eu10.hana.ondemand.com/cp.portal/site#WorkflowTask-...

This is an auto-generated email notification. Please DO NOT reply.

Kind Regards,
SAP Workflow Service

A sample of email notification




Step 2: Approval user task for Mass Maintenance of Sales Prices via SAP Intelligent RPA Bot



Properties

  • ID: usertask1

  • Name: Approval for Mass Maintenance of Sales Prices via SAP Intelligent RPA

  • Subject: Approval for Sales Prices

  • Recipient User: ${context.salesPrices.approveBy}


The design of approval form

Fields:


Decisions:


In runtime, the approval form of this user task look like this.




Step 3- Exclusive Gateway about Approve or Reject.


The following Exclusive Gateway about Approve or Reject




  • Approve as the default routine in the following Exclusive Gateway.

  • Reject routine with condition as
    ${usertasks.usertask1.last.decision=="reject"}

     


Step 4-(Approve routine) Prepare the payload to trigger SAP Intelligent RPA bot with api with a script task.


var rpaApiTrigger = {
request: {
"invocationContext": "${invocation_context}",
"input": {}
}
};
$.context.rpaApiTrigger = rpaApiTrigger;


Step 5-(Approve routine) Trigger the SAP Intelligent RPA bot via api with a service task


Service Task Properties


Destination irpa_api_trigger is defined in your SAP BTP, Cloud Foundry Environment for api trigger of SAP Intelligent RPA Bot. For example, as showed in the prerequisite section, I have an api trigger to my bot via url as https://api.irpa-trial.cfapps.eu10.hana.ondemand.com/runtime/v1/apiTriggers/d629028f-ef7f-4875-8198-....

  • URL: In my sample, the url is configure as
    https://api.irpa-trial.cfapps.eu10.hana.ondemand.com/runtime/v1/apiTriggersSince the full api trigger url of my bots has a format of
    https://api.irpa-trial.cfapps.eu10.hana.ondemand.com/runtime/v1/apiTriggers/<YOUR_BOT_TRIGGER_ID>/ru...

    Therefore we can configure the url of destination irpa_api_trigger with the common part, such as https://api.irpa-trial.cfapps.eu10.hana.ondemand.com/runtime/v1/apiTriggers, the rest /<YOUR_BOT_TRIGGER_ID>/runs will be set up in the path of service task in workflow as screen shot of Service Task Properties above as /d629028f-ef7f-4875-8198-207b1c564dd1/runs. During the run-time, the service task will compose the full url to trigger by combining the url in destination and path in service task for the http request.

  • Authentication: OAuth2ClientCredentials. Please refer to this online help for details of OAuth2ClientCredentials

  • Client ID: The client id from the service key of your SAP Intelligent RPA tenant

  • Client Secret: The client secret from the service key of your SAP Intelligent RPA tenant

  • Token Service URL: The authentication url to request access OAuth2.0 token from from the service key of your SAP Intelligent RPA tenant. Please refer to this online help about details. For example, the service key of my SAP Intelligent RPA tenant like this.
    {
    "uri": "https://tenant-url... .com",
    "uaa": {
    "uaadomain": "authentication.sap.hana.ondemand.com",
    "tenantmode": "shared",
    "sburl": "https://uaa-domain... .com",
    "clientid": "abcdef!a12345|xyz!a1234",
    "verificationkey": "-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----",
    "apiurl": "https://api.authentication-domain... .com",
    "xsappname": "abcdef!a12345|xyz!b1234",
    "identityzone": "identity-zone-name",
    "identityzoneid": "identity-zone-id",
    "clientsecret": "xxxxxxxxxxx=",
    "tenantid": "tenant-id",

    "url": "https://******trial.authentication.eu10.hana.ondemand.com/" <<---- this is the url property

    }
    }

    The url https://******trial.authentication.eu10.hana.ondemand.com is the domain of oauth 2.0 authentication to my SAP Intelligent RPA Tenant.

    And then just add /oauth/token to the domain as the Token Service URL.
    In this case, the Token Service URL of my SAP Intelligent RPA Tenant is
    https://******trial.authentication.eu10.hana.ondemand.com/oauth/token





Step 6: Prepare the result email


Prepare the result email with a script task
var approveTask = $.usertasks.usertask1.last;
var resultEmail = {};

var decision = 'Approved';

if(approveTask.decision === 'reject')
{
decision = 'Rejected';
}

$.context.salesPrices.approvalStatus = decision;

resultEmail.subject = 'Request ' + decision + ' for Mass Maintenace of Sales Prices ' + $.context.salesPrices.excelBaseFolder;

resultEmail.body =
'Dear '+ $.context.salesPrices.requestBy +
',\n\nYour request about mass maintenance of sales prices has been '+ decision + ' by ' + $.context.salesPrices.approveBy
+'\n\nPrice Excel Path: '+$.context.salesPrices.excelBaseFolder
+'\nRequested At: ' + $.context.salesPrices.requestAt
+'\nRemarks: ' + $.context.salesPrices.remarks
+"\nApprover's remarks: " + $.context.salesPrices.approvalRemarks
+'\n\nThis is a auto-generated email notification by SAP Worflow Service. Please DO NOT reply.'
+'\n\nKind Regards,'
+'\nSAP Workflow Service';

$.context.resultEmail = resultEmail;


Step 7: Result email notification with a mail task



A sample of result email in run-time



Summary


As you can see, we can easily enhance a process automation of SAP Intelligent RPA Bot with SAP Workflow Service by adding email notification for communication with mail task, user task such as approval, and triggering the SAP Intelligent RPA Bot via API trigger with service task. As a result, we can achieve Process Automation for Operation Efficiency and Process Flexibility for Business Agility at the same time.

In the next blog post, we'll do the same scenario with built-in Process Orchestration capability of SAP Intelligent RPA Cloud Studio, which has the build block of automation, user task and process.

 
13 Comments