Lesson 2 of 5
SAP business events: from S/4HANA and RAP to the broker
11 min
Listen to this lesson
Contoso does not have to invent events for sales orders. SAP S/4HANA ships standard business events, and SAP's architecture guidance counts more than 600 of them across finance, sales, procurement, manufacturing and other areas. They are documented in the SAP Business Accelerator Hub, which lists event types, payload schemas and AsyncAPI specifications. Before designing anything, Kenji's team checks there whether a standard event exists for the object and release they need.
Names, topics and versions
A standard event has a type such as sap.s4.beh.salesorder.v1.SalesOrder.Created.v1. Read it left to right: SAP, S/4HANA, business event, the business object and its version, the entity, the operation, and the event version. When published to a broker, the same event appears on a slash-separated topic such as sap/s4/beh/salesorder/v1/SalesOrder/Created/v1, usually behind a namespace the broker assigns to the producing system. Two versions in the name matter for testing: a new v2 of an event is a new contract, and consumers should subscribe to the versions they were built and tested for.
Publishing from SAP S/4HANA: channels and bindings
In SAP S/4HANA (on-premise and private edition), event publication is configured with enterprise event enablement. Conceptually there are two steps. First, a channel connects the system to a broker. Practitioner guides and SAP's tutorials create it in transaction /IWXBE/CONFIG from the broker's service key, check the technical user, and activate it. Second, an outbound binding (transaction /IWXBE/OUTBOUND_CFG) assigns the topics to publish on that channel, for example the sales order Created and Changed topics. Without a binding, nothing is sent, however many sales orders Maria creates. The consuming direction has its own pieces: an inbound binding and a queue subscription. Exact screens and authorizations vary by release, so follow the documentation for yours; in public edition the equivalent setup is done in its own configuration apps.
- Find the eventBusiness Accelerator Hub: SalesOrder events, payload and AsyncAPI file
- Create the channelConnect CMP to the production broker instance with its service key; activate
- Bind the topicsOutbound binding for SalesOrder Created and Changed on that channel
- Create the consumer queueIn the broker: a queue for the fleet notifier, subscribed to those topics
- Prove itCreate a test order in CMQ and see the event arrive in the test queue
Custom events with RAP
When no standard event fits, the ABAP RESTful Application Programming Model (RAP) lets developers define business events on their own business objects. SAP's RAP training describes the mechanics: the event is declared with the keyword event in the behavior definition, optionally with a parameter whose type is a CDS abstract entity (the payload); it is raised with the EML statement RAISE ENTITY EVENT in the behavior pool, preferably in the saver methods during the save sequence; and it cannot be raised for draft instances. An event binding, an ABAP repository object, maps the event to the SAP event infrastructure so external consumers can receive it. Events can also be consumed locally by an event handler class, and that consumption is always asynchronous. SAP's tutorials note that native RAP event exposure and consumption are available on-premise from release 2022.
Kenji's team uses this for Contoso's custom core return agreements, the custom table carried over from ECC: the RAP business object ZR_CMC_CoreAgreement over those tables raises an agreementCreated business event (and agreementClosed when an agreement is closed), so the warranty app on BTP can react without reading the table directly.
| Event Mesh capability of SAP Integration Suite | SAP Integration Suite, advanced event mesh | SAP Cloud Application Event Hub | |
|---|---|---|---|
| Positioned for | Starter and low-to-moderate volume scenarios, SAP and third party | Enterprise-wide, high-volume, distributed event meshes | Event integration between SAP cloud applications and BTP apps |
| Deployment | Central service within SAP BTP | Brokers in SAP-administered or customer-owned regions, cloud or on premise | Managed by SAP; topics and queues abstracted away |
| Notable features | Publish-subscribe, guaranteed delivery, basic queue and topic management | Adds event streaming, replay, dynamic routing, event portal for governance | Subscriptions activated per integration dependency |
What would you do?
A developer proposes reading the core return agreements table directly from the warranty app every few minutes, because "building a RAP event is extra work". What should Kenji decide?
- S/4HANA ships hundreds of standard events; check the Business Accelerator Hub first.
- Event type names carry business object, entity, operation and versions; topics use the slash form.
- Publishing needs an active channel to the broker and outbound bindings for the topics.
- RAP business events: declared in the behavior definition, raised with RAISE ENTITY EVENT in the save sequence, exposed by an event binding.
- SAP's brokers differ in scale and purpose; keep one broker instance per stage.
Check your understanding · not graded
Lesson check
1. Where do you check whether a standard S/4HANA event exists, with its payload schema?
2. A channel is active, but no sales order events arrive. What is the most likely missing piece?
3. How is a RAP business event raised?
4. What does an event binding do in RAP?