Notifying MDG CR processor via MS Teams
2023-10-18 00:35:18 Author: blogs.sap.com(查看原文) 阅读量:5 收藏

#0 Introduction

In this scenario, when a CR is submitted in MDG and assigned to processor by workflow, the assignment of the workflow is notified by directly mentioning the processor in the MS Teams channel to which the processor is subscribed.

#1 Requirement

There are many references on how to send MDG workflow notifications by e-mail, but there was no case to send notifications through MS Teams, so I tried to make it through personal study.

#2 Solution

To make this scenario work, the following components were needed.

  • SAP Buseinss Workflow(MDG Ruled based Workflow)
  • SAP Event Mesh
  • SAP Cloud Integration
  • Node.js application
  • Postman (For test)

Each role is described below.

1. SAP Buseinss Workflow(MDG Ruled based Workflow)

  • Get MDG’s CR number, user ID, and user email, and sends a queue to the SAP Event Mesh. In this case, by adding step and task to RBW’s Workflow Template, all Dialog steps send queues to the Event Mesh. Of course, there is a method called Sub-Workflow, Calling Method in RBW, but this method is good in that you don’t have to fight for a long time with RBW’s Decision Table.
  •  The task sends a queue to the Event Mesh via ABAP classes and methods with data in  JSON format. JSON contains CR number, user ID, and Email.

2. SAP Event Mesh

  • Two queues are required. One is a queue that receives messages sent from S/4HANA On-premise. One is a Queue for receiving messages sent from CPI, which will be described later, and sending notifications to channels using MS Teams Webhooks.
  • MS Teams does not allow chatting with specific users through API. That’s why I use posts to channels rather than chat directly to the user. SAP Event Mesh supports webhooks, so posting to channels is easy.

3. SAP Cloud Integration

  • Receives the Queue and makes a REST API POST call, converts the JSON data into a form suitable for Ms Teams Webhook, and returns it to the Event Mesh Queue.

4.Node.js Application

  • Called from CPI’s iFlow, it processes JSON data in a format suitable for the webhook and returns it.
  • CPI also has a way to edit JSON (Groovy), but I personally made a simple API because JSON processing in JavaScript was convenient.

#4 Conclusion

As shown in the video below, the mention reaches the user.

It was not feasible in this scenario because I have no knowledge in the MS ecosystem, It seems possible to create an MS Teams Bot and notify only that user via chat.

Referenced documents are as follows.

– How to trigger an API in ABAP

https://blogs.sap.com/2020/12/18/configuring-oauth-2.0-and-creating-an-abap-program-that-uses-oauth-2.0-client-api/

-EventMesh Messaging API

https://api.sap.com/api/SAPEventMeshDefaultMessagingAPIs/overview

-Sending and receiving queues from CPI to Event Mesh

https://blogs.sap.com/2023/05/13/use-cpi-amqp-adapter-to-test-btp-event-mesh/

– Node.js application development in BTP environment
https://developers.sap.com/tutorials/btp-cf-buildpacks-node-create.html


文章来源: https://blogs.sap.com/2023/10/17/notifying-mdg-cr-processor-via-ms-teams/
如有侵权请联系:admin#unsafe.sh