Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
Showing results for 
Search instead for 
Did you mean: 


In today's dynamic business world, the demand for systems adept at real-time data handling and swift responses has surged. Event-driven architecture, exemplified by the SAP Event Mesh, addresses this by allowing systems to promptly respond to changes, optimizing both performance and efficiency. Leveraging this, I developed a prototype simulating the order-to-cash process. This process—from order to payment—can be riddled with inefficiencies, particularly in transportation. Through my integration of SAP Event Mesh and SAP S/4HANA Cloud, I aim to demonstrate the potential for businesses to elevate transparency, speed, and adaptability.

What this blog covers

  • SAP Event Mesh

  • S/4HANA Cloud order-to-cash

  • Simulation building

  • Kyma


The O2C process is a holistic business workflow that kicks off when a customer places an order and concludes with payment collection. It spans multiple phases like order management, delivery, invoicing, and payment receipt. At its core, the process aims to enhance operations and boost cash flow.

A foundational grasp of event-driven architecture (EDA) and the Event Mesh would also be advantageous: EDA is a software paradigm where systems are built around events. "Producers" create events signaling state changes, while "consumers" act upon these events. Instead of constantly checking for updates, EDA systems are reactive, responding as events arise. This structure offers not only a separation between producers and consumers, ensuring adaptability and scalability, but also a boost in efficiency, particularly in real-time contexts.

Event Mesh in SAP BTP: This is a service within SAP's Business Technology Platform, catering to event-driven designs. It serves as a bridge allowing "producers" to create and relay events, with "consumers" poised to subscribe and handle them. Harnessing the power of cloud-native solutions, the Event Mesh facilitates real-time data transmission across various services. Its ability to integrate diverse components, even from differing platforms, is key for seamless asynchronous interactions. For further explanation see: https://help.sap.com/docs/event-mesh/event-mesh/what-is-sap-event-mesh

The Prototype

To visualize the O2C I decided to build a simulator to be independent of user input and to focus on outlining the process end-to-end. For the simulation scenario, picture a Japanese company located in Yokohama receiving a sales order from a customer in Osaka.


As the simulation rolls out, an event timeline on the right displays a sales order. This order is not mere imagery; the simulator generates it in real-time using the S/4HANA Cloud API. In response, the Event Mesh emits an event, alerting all services subscribed to the "sales order created" notification. Once this event is acknowledged, the system readies the outbound delivery and posts the goods issue. An interesting note: the IDs you observe are authentic and generated within the S/4HANA Cloud, allowing for real-time tracking.

The next stage is transportation. The system updates the truck's position every second, factoring in both the simulation speed and the truck's actual speed. On highways, for instance, the truck might go between 65-80 km/h. You can also see events like traffic jams affecting the delivery speed.

Usually, gathering this type of data requires making a lot of API requests or using other servcices, which can be cumbersome. However, the event-driven approach simplifies this. While I didn't incorporate every aspect, such as the financial details, the transportation demonstration should provide a clear picture of the process.

Core Features

  • Simulation of the O2C process until goods are received by the customer, including order generation, warehousing, and transportation.

  • Random generation of non-SAP events such as traffic jams or road blockages.

  • Integration of S/4HANA Cloud and Event Mesh.

  • Interactive user interface with a map, simulation controls, event timeline, and other relevant information.

simulation controls and map


current truck speed (km/h) and event timeline


route information and 3d model of moving truck


Beyond the Event Mesh and S/4HANA Cloud, I employed three main technologies:

  • NodeJS: An open-source, cross-platform JavaScript runtime environment. It's primarily used for building fast and scalable server-side applications. In the prototype, NodeJS facilitated efficient backend processing and seamless API interactions.

  • Kyma Runtime: A Kubernetes-based platform tailored for extending applications with microservices and serverless functions. For deployment in the prototype, Kyma Runtime provided a cloud-native environment, ensuring scalability and resilience.

  • Svelte: A radical new approach to building user interfaces, Svelte shifts much of the work to compile time rather than runtime. As the chosen frontend technology, Svelte ensured a responsive and efficient user experience, streamlining the web client's interactions with the backend services.


system architecture of the prototype


The architecture detailed offers a broad overview of the prototype's primary components and system interactions. Central to this design is the O2C backend, comprising several microservices, each tailored for distinct tasks. These microservices liaise with the Event Mesh and initiate API interactions with the S/4HANA Cloud. Additionally, the backend dispatches frequent updates to the O2C Frontend every second, accessible to any web client. Both the frontend and backend systems are deployed on the BTP Kyma runtime. Notably, the Event Mesh facilitates communication not just with the backend but also with S/4HANA Cloud. This is crucial as O2C events originate directly within S/4HANA Cloud and are then broadcasted to all subscribed event consumers.

Used S/4HANA Cloud APIs


Benefits of using SAP EM with S/4HANA built in events

  1. Real-time Integration: One of the primary benefits of using SAP Event Mesh with S/4HANA is the ability to process and react to data in real-time. As events happen in S/4HANA – be it order creation, stock updates, or payment confirmations – the system instantly broadcasts these changes. This immediate data propagation ensures that other integrated systems can swiftly act upon these changes.

  2. Reduced Complexity: Traditional polling methods require systems to frequently check for data changes, often leading to increased system loads and unnecessary complexity. With Event Mesh, systems wait for events to be pushed to them, eliminating redundant data checks and streamlining integration.

  3. Scalability: As businesses grow, their data processing needs evolve. Event Mesh's decoupled architecture ensures that as the volume of events increases, both the producers (like S/4HANA) and the consumers can scale independently, ensuring optimal performance.

  4. Enhanced Reliability: Built-in events from S/4HANA are designed to be robust and comprehensive. When combined with the SAP Event Mesh, businesses can be assured of consistent data quality and integrity. Event Mesh ensures that events are reliably delivered to the right consumers even in cases of network interruptions or system failures.

  5. Agility and Flexibility: In today's rapidly changing business landscape, the ability to adapt is crucial. Using SAP Event Mesh with S/4HANA's built-in events allows businesses to quickly add or modify event consumers. This flexibility ensures that as business needs change – be it adding new sales channels, integrating new systems, or modifying existing workflows – the integrations can be updated with minimal disruptions.

  6. Optimized Business Workflows: By having an immediate view of business events as they occur in S/4HANA, companies can optimize their workflows. For example, if a stock level drops below a threshold, an event can trigger an immediate reordering, ensuring continuous supply chain operations.


Conclusion and Outlook

In today's fast-paced business environment, the SAP Event Mesh proves crucial. This prototype highlights how the Event Mesh handles real-time data effectively. By connecting different parts of the order-to-cash process, it ensures everything runs smoothly and quickly.

Using tools like NodeJS, Kyma, and Svelte along with the Event Mesh and S/4HANA Cloud makes the system even more efficient. These technologies help manage tasks faster, deploy things easily, and improve the user interface. The Event Mesh stands out in making sure everything communicates well and reacts quickly.

In short, this prototype shows the importance of having a system that can quickly respond to changes. With SAP Event Mesh at its core, businesses can be more efficient and better serve their customers.