Our SAP power users use Microsoft Teams as their primary communication platform. As the SAP design team, we wanted to enable them to request SAP master data changes using Teams. This would not only enable them to initiate the required changes at any time, but it would also eliminate the need for a separate mobile application and end-user training. I worked on this project with anupam.kapoor, who was quite instrumental on this project with setting up Azure authentication, getting M365 API, and setting up the power automate approval workflow. Let's get started!
When data is rendered from SAP CAI, it is posted to a SharePoint list. This action initiates a workflow request for the master data governance team to either approve or reject the work item. Upon successful approval, the approver’s details are captured and populated in the list. The SAP iRPA API is triggered finally that commits changes to our SAP ECC system.
Below is a high-level data flow diagram of this process, when a user initiates this request using Microsoft teams:
We needed to introduce only a few features to our user group, so we created an intent-based CAI bot. Custom intents were developed, and vendor number validations were performed using a regex.
A collection of company-specific codes is required for validation on the CAI. These codes are kept up-to-date by an API call.
Listed below are the business skills that were designed on the SAP CAI platform for this bot application:
Whenever a user enters data that is not recognized by custom entities, the disambiguation skill is triggered, and the data is reset in the chat bot. Upon successfully gathering all the necessary data and before it is rendered to the SharePoint list, a final confirmation is presented to users via the memory variables:
If the user chooses not to proceed with the submission, the data is reset. Alternatively, the SharePoint list is populated automatically with the data that is gathered using a RestAPI call on the MS Graph API, which is connected via bearer tokens.
The following sections provide the details on how the SAP and Microsoft applications are connected to each other.
Step 1: Connecting SAP CAI with MS Teams
For a step-by-step guide for setting up this connection, click the bot channel on the CAI platform. You can also find step-by-step instructions in this tutorial post. Note that you’ll need admin access on the Azure portal for bot registration.
Step 2a: Register Graph API using a Daemon App
Upon logging into the Azure portal as an admin, register the SharePoint application using a deamon app by following these steps:
Configure the following permissions for the daemon application to interact with SAP CAI in the background:
After completion, the integration assistant on the MS Azure portal will display as follows:
Step 2b: Populating SharePoint List Values from SAP CAI
This step explains how the data is communicated to the MS SharePoint list using bearer tokens from SAP CAI.
The initial call is made to get the bearer token. Note that this call should be made with no authentication with the registered tenant ID on the MS Azure portal.
The tenant ID can be found in this section on the MS Graph API:
The header section should now look like this:
The body of the payload must follow this syntax:
The Client ID and Client Secret can be found in this section on the MS Azure Portal:
Use the bearer token captured in a previous step to populate the values in the MS SharePoint list:
Authorization is granted by the bearer token:
The payload details that will post data to the SharePoint list will resemble the following:
Participant_data will contain username details from MS Teams. More information about the system variables can be found here at SAP help site.
After the data is transmitted successfully, the values on the SharePoint list will resemble the following:
Step 3: Expose SAP iRPA Automation as an API
When automation is created using SAP iRPA, it can be exposed as an API (or API trigger) for remote initiation. The prerequisite is to create the bot, and if it has any variables, they must be supplied when calling this API. Refer to the following screenshots to expose automation as an API.
When naming the API trigger, you can also set the priority for the API call, including job expiration time.
The payload will resemble the following:
Finally, the SAP iRPA Key must be created for the trigger in the Environments section. It is supplied in the next step when it is called from the Power Automate workflow.
Step 4: Power Automate Workflow
Whenever a new item is created in this SharePoint list, the workflow is triggered. The approvals can be designed in numerous ways. For example, the username can be captured from MS teams in CAI and used in the workflow to determine the approver. The workflow is configured as follows:
Step 5: Call the SAP iRPA API from the MS Power Automate Workflow
After the workflow is approved, it can be called as an API by an external system. The iRPA automation must first be exposed as an API. It can then be called from the workflow using bearer tokens, as follows:
When these applications are connected, the CAI bot feature allows users to conveniently request SAP master data changes from MS Teams, eliminating the need for individual SAP update transactions. Although this automated feature is fairly simple, it meets a common need today and provides a solid step toward ever more advanced automation in the future.