Microsoft Teams integration
The integration between PreBilt for EWM™ Operator Messaging and Microsoft Teams using Power Automate facilitates seamless communication between PreBilt for EWM™ users and your organisations' Teams channels, enabling notifications and real-time messaging. The guide is intended for SAP consultants and IT professionals tasked with implementing the integration.
Prerequisites
SAP requirements
The SAP EWM system must have PreBilt Operator Messaging enabled.
Appropriate authorizations must be in place to allow the creation of function modules and enhancements.
A custom ZVariable table must be created to store Microsoft Teams channel names.
The ZVariable table must be case‑sensitive.
Maintain MS Teams channels and warehouse numbers in the corresponding ZVariable table.
Communication between the SAP system and the internet (or middleware for closed networks) must be established.
The customer is responsible for working with SAP to configure the Load Balancer, manage certificates via STRUST, and ensure all required connections are in place.
A BASIS contact is required for SM59 configuration. Alternatively, granting TCT direct access is preferable.
SM59 configuration includes:
RFC Destination
Connection Type
Description
Technical Settings (Host, Path Prefix, Proxy Host, Proxy Service)
Logon & Security (SSL Client PSE ID)
Special Options
Microsoft Power Automate
A dedicated Service User account must be configured with the appropriate permissions to import, view, and modify Power Automate flows.
One Microsoft Teams and one Office 365 connection within Power Automate must be established using the Service User account.
Imported Power Automate flows must be clearly named to reflect the target environment (e.g., DEV, QUALITY, PRODUCTION).
Ownership of each Power Automate flow must be assigned to the designated Service User account.
Each instance of the "PostPBMessagefromWebhook" flow must use a unique Webhook URL for its corresponding environment.
(Preferable) TCT should be granted administrative access to both the Power Automate platform and the associated Service User account.
Ensure that Power Automate flows are switched on in each environment before use.
Microsoft Teams
A dedicated Team must be agreed upon and set up within Microsoft Teams.
Dedicated Channel(s) must be created within the agreed Team.
The Power Automate Service User must be added as a member of the relevant Teams channels.
Architecture

The process begins in the PreBilt for EWM UI application when a user selects a specific message type associated with a receiver type “T” in /N/TCTM/EWM_OMCFG.
In the backend, the enhancement implementation ZTCTM_EWM_SRV_OM_NOTIF_MSTEAMS, configured with a filter value of RCV_TYP = T, within the BAdI /TCTM/EX_EWM_SRV_OMSG_NOTIF, manages the outbound message logic.
The implementing class method /TCTM/IF_EX_EWM_SRV_OMSG_NOTIF~SEND puts the function module call into an RFC queue.
The function module ZTCTM_EWM_SRV_OM_NOMST_SEND is responsible for constructing the payload. It retrieves a JSON-based wrapper and adaptive card templates from the SAP MIME Repository, replaces placeholders such as {team}, {channel}, and {message} with actual data, and sends the final payload via an HTTP POST request to the webhook URL of the "Post PB Message from Webhook" workflow.
The webhook connection is managed via an SM59 HTTP destination of type G. This allows environment-specific configuration (e.g., Dev/QA/Prod) to be maintained centrally without hardcoding URLs or using TVARV/Z tables.
The ABAP code retrieves the destination using cl_http_client=>create_by_destination, with the actual endpoint and proxy settings maintained in the SM59 configuration.
The webhook URL within the workflow acts as an endpoint to listen for incoming HTTP POST request, when it receives the payload, it will process the data and posts an adaptive card message to the appropriate Microsoft Teams channel,
The trigger for this workflow is “When a teams webhook is received”
When a user replies to an adaptive card message in Teams, the reply triggers the second Power Automate workflow “Handle PB Message Response”, which processes the reply and sends the data back to SAP with the help of a custom connector “API HUB PROXY”.
This reply is routed to the SAP ICF service ZTCTM_EWM_OM, which acts as the inbound endpoint for handling incoming messages. If the customer has implemented a Web Dispatcher, the reply is first routed through the Web Dispatcher, which securely forwards the HTTP request to the SAP backend.
The ICF service uses the handler class ZTCTM_EWM_OM_MSTEAMS_HANDLER.
The handler method IF_HTTP_EXTENSION~HANDLE_REQUEST validates the reply, identifies the SAP user based on the email address in the payload, and retrieves the original message details using the message ID. It then creates a new message in SAP using the core service class /TCTM/EWM_SRV_OM_CORE. The new message is delivered back to PreBilt device through the ewm_push_channel WebSocket service.
Last updated
Was this helpful?