Using Microsoft Adaptive Cards in Supply Chain scenarios
We know that email or a pop up window could be used as a notification about an event. But if you are expecting a user reaction from that notification – you might consider adding a button or a link that can trigger the expected action. We also know that lot of these actions could be meaningless if they lack details that lead to decision making. A notification email might be boring, or the notification window might be too small. An interesting overture to address this could be usage of contextual notifications. Adaptive Cards from Microsoft not only offer the contextual awareness, but allow the user to trigger certain actions in a plethora of user interface components . Since adaptive cards are also an open source technology, it makes it even more interesting. In this blog, I like to share some scenarios where we used Adaptive Cards to existing business process in SAPs Digital Supply Chain.
Why Adaptive Cards?
The two main cloud services we use in this Digital Supply chain scenario are SAP Integrated Business Planning and the Ariba Network. We are creating a Supplier Forecast using SAP IBP and sending this to a known supplier on the Ariba Network. During the communication between the SAP IBP and the Ariba Network, there are messages exchanged which might go wrong or succeed, but they generate notification emails with a information such as Ariba Network ID, time, etc. However, the notification email has less contextual info about the payloads contents being exchanged. So we considered the use of Adaptive cards here to bring in the rich contextual information. Some interesting facts about choosing Adaptive cards were,
- With a JSON structure, one can create and adapt the layout of the cards – which is adds flexibility to the user interface.
- It is very expressive – allows to dynamically add contextual details, depending on the processes or event.
- No client side coding or scripting is needed as it runs out of the box using standard communication tools like MS Teams or MS Outlook.
Let me explain the basic flow, before I go into the details of Adaptive Cards.
At a high level
SAP Integrated Business Planning
I created a planning area in the SAP IBP instance based on the SAP7F sample planing model. Master data was imported into this planning area from an S4H system using real-time-integration (Step 1). Then I created a simple planning view in Excel (Step 2) using the IBP Excel plugin. In this Excel sheet, I am using a key figure (Unconstrained Forecast) which is defined with a planning level – Product, Location To, Customer on a daily basis. This key figure is what I send to a Supplier on the Ariba Network. Usually, one uses the Data Sharing app in SAP IBP to communicate with the Ariba Network. Since I like to add some custom logic to the process, I am not using the app, rather working it out from Excel. I created a macro using Visual Basic and attached it to a Button in the Planning View Excel sheet. On pressing the button an action listener would send this data. To consume the Ariba Network API’s I need to create a cXML payload which might have to be mapped to different IDs that are relevant for the Supplier on the Ariba Network.
SAP Cloud Integration Suite.
To work with cXML payloads, I considered the SAP Cloud Integration Suite. The excel macro makes a REST call to an iFlow build in the SAP Cloud Integration Suite. This iFlow is used to call the SAP IBP instance to fetch the data, prepare a payload for the cXML structure, map the IDs and then call the Ariba Network to send the Forecast as a ProductActivityMessage to the Supplier (Step 4). Once this payload is acknowledged on the Ariba Network, I am creating an Adaptive Card which can be sent to the Supplier as well as the Buyer that this data is being received on the Ariba Network (Steps 5 & 6). For the Buyer details such as the acknowledgement of the message is more than enough at this point. But for the Supplier the Adaptive card could make a difference.
Microsoft Adaptive Cards
The iFlow in the SAP Cloud Integration Suite is creating the JSON structure which is contains the contextual data needed for the cards. This data is sent to a Logic App running on Microsoft Arzure cloud platform. The authentication is done using Client Certificate generated on the Azure platform. The Logic App listens for the inbound JSON. One can create a JSON Schema before hand at this HTTP Listener so we can generate helper functions to access the different objects and key of the JSON payload.
In this logic app, we are iterating over all the row items of a Supplier Forecast and creating a snapshot view of the Product Activity message that was sent to the Ariba Network. The flow bot on the Logic app would post the card either on the MS Teams or send an email to an Outlook inbox. The card also has two buttons which can be used to trigger a follow up iFlow or another endpoint. The button “Reject” would simply ignore the message. No action is taken for that in this example. The button “Import to IBP” will send a trigger to the Logic app. On this trigger, the app would call an iFlow on the SAP Cloud Integration Suite. This flow uses the data provided by the Logic app to call the Ariba Network and download the Forecast data sent to him by the Buyer.
In this example we can consider an SAP IBP system as a planning application used by the Supplier. We have defined a key figure called “Buyer Forecast”. The iFlow downloads this supplier forecast and send it to the Supplier’s IBP system via RFC connection (Steps 7 & 8). One is free to use either RFC or oData calls here. From my observation, I found a couple of advantages using contextual notifications via Adaptive Cards,
- Imagine the supplier is getting 100s of requests, since he can see the quantities and item details in the requests, he can prioritize which Buyer he might give first preference or answer immediately based on his current inventory or warehouse location for example.
- Since he already gets a notification via the Ariba Network, adding context makes that more expressive and also actionable.
- There is a smooth transition of message payloads between the systems with very less human intervention. From the user experience point of view, the Buyer uses an Excel sheet to trigger sending data and the Supplier uses Outlook or Teams to download the payloads. This reduces the burden of users to learn the quintessence in tools like IBP and Ariba Network. Once setup, the end to end flows can be scaled to a lot of users.
There are quite a lot of examples how Adaptive Cards are getting popular in business processes at SAP. I found this tool – Adaptive card designer quite interesting to shape the Card layout. There are tons of blogs and tutorials one can use to learn them too. Here is an example of how Adaptive Cards were used to bring contextual awareness in a notification and help the user to react to it from a popular communication tool. If you have other use cases or you might think or something interesting on these lines, please feel free to share them in the comments.
It was one of first projects using Adaptive Cards and I like to say a big thanks to Martin P from Microsoft. The amount of time we invested in pair programming was just less than 2 days to get this end to end working. A big thanks to the rest of team at Microsoft – Holger B, Roman B, Martin R and Lei who helped and guided in all the discussions we had before the start.
Domnic Savio Benedict
Great E2E use case! I would love to get more information/understanding on the 'adaptive card' capability and sharing this via MS Teams.
Could you please send me an email at email@example.com, so that we can discuss this please.