Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 2 of 5

SAP business events: from S/4HANA and RAP to the broker

11 min

Listen to this lesson

0:00 / 15:32

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.

Event sourcesSAP S/4HANA standard events; custom RAP business events; other SAP and non-SAP applications
Event enablement in S/4HANAChannels to a broker and outbound bindings that decide which topics are published
Event brokersEvent Mesh capability of SAP Integration Suite; SAP Integration Suite, advanced event mesh; SAP Cloud Application Event Hub for SAP-to-SAP scenarios
ConsumersExtension apps on SAP BTP, integration flows, other SAP back ends, third-party systems
The layers of SAP's event-driven ecosystem.
The Sign-Off Table · thesignofftable.com/academy/sap-btp-303

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.

When Maria saves orders and nothing arrives, check each link of the publishing chain in order, starting with the channel.
The Sign-Off Table · thesignofftable.com/academy/sap-btp-303
  1. Find the eventBusiness Accelerator Hub: SalesOrder events, payload and AsyncAPI file
  2. Create the channelConnect CMP to the production broker instance with its service key; activate
  3. Bind the topicsOutbound binding for SalesOrder Created and Changed on that channel
  4. Create the consumer queueIn the broker: a queue for the fleet notifier, subscribed to those topics
  5. Prove itCreate a test order in CMQ and see the event arrive in the test queue
Contoso's steps to publish sales order events. Each stage pairs its own S/4HANA system with its own broker instance.
The Sign-Off Table · thesignofftable.com/academy/sap-btp-303

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.

A custom RAP business event is raised in the save sequence and reaches external consumers only through an event binding.
The Sign-Off Table · thesignofftable.com/academy/sap-btp-303

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 SuiteSAP Integration Suite, advanced event meshSAP Cloud Application Event Hub
Positioned forStarter and low-to-moderate volume scenarios, SAP and third partyEnterprise-wide, high-volume, distributed event meshesEvent integration between SAP cloud applications and BTP apps
DeploymentCentral service within SAP BTPBrokers in SAP-administered or customer-owned regions, cloud or on premiseManaged by SAP; topics and queues abstracted away
Notable featuresPublish-subscribe, guaranteed delivery, basic queue and topic managementAdds event streaming, replay, dynamic routing, event portal for governanceSubscriptions activated per integration dependency
SAP's event brokers, as described in SAP's EDA reference architecture. Check current service descriptions before choosing.
The Sign-Off Table · thesignofftable.com/academy/sap-btp-303

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?

Key points
  • 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. 1. Where do you check whether a standard S/4HANA event exists, with its payload schema?

  2. 2. A channel is active, but no sales order events arrive. What is the most likely missing piece?

  3. 3. How is a RAP business event raised?

  4. 4. What does an event binding do in RAP?