SAP S/4HANA Cloud, SAP Conversational AI, SAP Intelligent Robotic Process Automation

Automating Creation of Purchase Order Process with MS Teams


SAP Intelligent Robotics Process Automation automates the enterprise business processes. Cloud Studio is used to design the end-to-end workflows and the packages can be generated into the cloud factory in SAP BTP. On-premise agent is responsible for execution of these packages and act as digital assistant (attended automation) or as a digital worker (unattended automation).This blog explains step-by-step process on how to automate the creation of purchase order using Manage Purchase Orders FIORI Application in SAP S/4 HANA Cloud, triggering the automation in the SAP Chatbot using SAP Conversational AI, and then integrating with Microsoft Teams


  • You have an access to to the RPA service: Subscribe to SAP Intelligent RPA Service in SAP BTP
  • You have installed the on-premise components: SAP Intelligent RPA On-premise Installation
  • You have an access to the S/4HANA cloud trial S/4 HANA Cloud trial
  • You have an access to SAP Conversation AI
  • You have an access to Azure Portal

Installation steps for the Desktop agent

Please note the minimum version of the Desktop Agent supported by SAP Process automation is 2.0.20.

1. Use SAP UI5 Recorder to Automate Creation of Purchase Order in SAP S/4 HANA Cloud: The steps are described below

Generate Package – Once the automation project is created, the package can be generated by clicking the “Generate Package” in the Overview tab

Release Package – Navigate to the package tab of the Automation factory

Create an API Trigger –

API trigger opens a dedicated endpoint which allows the execution of the automation by the external application

In the API trigger information pop-up, click Copy and paste it in a notepad (API URL). Click Close. The newly generated trigger is visible in your Environment.

Generating new API Key –To generate a new API key, click Add API Key

Click Copy and make sure to note down the key

Creating Service Key in SAP BTP Trial –

Name the Service key and click Create

View the Service key and copy the clientid, clientsecret and URL

2. Chatbot Integration

SAP Conversation AI configuration – Creation of chatbot in Conversational AI account

Create the Intent based chatbot by clicking the new New Bot. Select the predefined skills like greetings, weather etc.

Forking the Intent – Train the intent by using the expressions.

Add skill – In the build tab, click on add skill

Go to the skill and click on trigger to add the forked intent created above

Click on the action type and create new action group and then Click Connect External Service and then click CONSUME API SERVICE.

API Service Configuration

  • POST URL – paste the API trigger URL (API URL in API trigger information above)
  • Client ID – paste from the Creating Service Key in SAP BTP Trial section above
  • Client Secret – paste from the Creating Service Key in SAP BTP Trial section above
  • Authorization URL-paste from the Creating Service Key in SAP BTP Trial section above appended with suffix /oauth/token (https://<yourtenant>

Go to the Headers tab and click New Fields and add below

irpa-api-key = key copied from Generating new API Key

In the body tab, add below

“invocationContext”: {
“conversationId”: “{{conversation_id}}”
“input”: {}

Generating Token – Generate design time APIs token in SAP CAI to be able to authenticate the APIs successfully

Copy the Developer token and save it

Note down Auth URL, Client ID and Client Secret from the generated token

The Developer token and Design time APIs token information will be used in the next step to create Notifiers

Create Notifiers – Three Notifiers for notifying Start, Success and Failure status while sending message to chatbot in CAI

  • Start – Notify the start of automation
  • Success – Notify the completion of automation
  • Failure – Notify if automation fails with error details

These triggers are created in the environment tab of the Automation factory

The same way start and failure triggers can be created

  • Token – Developer token
  • Auth URL – Design time APIs token Auth URL – copied above
  • Client ID – Design time APIs token Client ID – copied above
  • Client Secret – Design time APIs token Client secret – copied above

3. MS Teams Integration

Click the connect tab in SAP CAI and click on MS Teams third party channels and copy the Messaging endpoints which will be used later in MS Azure resource (MS Azure Portal)

Log into Microsoft Azure and create a new Azure Bot resource

post creation, click on the resource and then configuration

Add copied values in SAP CAI

Messaging endpoint is coped as mentioned above

Copy the Microsoft App ID and Secret key Value

Go back to the Azure Portal and click on channels and MS teams and then publish

Click on Open in Teams to complete the MS team integration with SAP CAI chatbot