This document describes how to install and configure the Business Eventing Toolkit for SAP.
Install the Business Eventing Toolkit for SAP
When you install the latest version of the on-premises or any cloud edition of ABAP SDK for Google Cloud, the Business Eventing Toolkit for SAP is installed for you. For information about the installation steps, see Install and configure the on-premises or any cloud edition of ABAP SDK for Google Cloud.
If you're using version 1.9 or earlier of the on-premises or any cloud edition of ABAP SDK for Google Cloud, then update your SDK to the latest version to get the Business Eventing Toolkit for SAP. For more information, see Update ABAP SDK for Google Cloud.
Enable the target Google Cloud APIs
Before using target Google Cloud services, ensure the corresponding Google Cloud APIs are enabled in your project. For example, if you plan to publish events to Pub/Sub, enable the Pub/Sub API.
For information about how to enable Google Cloud APIs, see Enabling APIs.
Set up authentication
Once you set up authentication to access Google Cloud APIs in your on-premises or any cloud edition of ABAP SDK for Google Cloud, the Business Eventing Toolkit for SAP uses the same authentication method to publish SAP events to Google Cloud APIs. For information about how to set up authentication in the on-premises or any cloud edition of ABAP SDK for Google Cloud, see Authentication overview.
Make sure the service account configured in ABAP SDK for Google Cloud client key configuration has the required IAM roles specific to the target Google Cloud service.
Make a note of the client key that you've created as part of the authentication setup. You use this client key when configuring the Business Eventing Toolkit for SAP in your SAP system.
Configure CloudEvent attributes
You can maintain default values for CloudEvent attributes. These values are
stored in the table /GOOG/CE_DEFAULT
.
This is an optional configuration. You can either pass CloudEvent attributes or override the default attributes directly in your code.
To configure CloudEvent attributes, do the following:
In SAP GUI, execute the transaction code
/GOOG/SDK_IMG
.Alternatively, execute the transaction code
SPRO
, and then click SAP Reference IMG.Click ABAP SDK for Google Cloud > Basic Settings > Business Eventing: Configure Context Attributes for Cloud events.
Click New Entries.
Enter values for the following fields:
Field Data type Description Cloud Event Default Attribute Key String Specify a name for the default CloudEvent attribute configuration. For Example: CLOUD_EVENT_ATTRIBUTE_KEY. Source String Provide the URI-reference that identifies the context in which an event occurred. ID String Unique identifier for the event. Producers must ensure that Source + ID is unique for each distinct event. Specification version String The version of the CloudEvents specification which the event uses. If you leave this blank, the system uses 1.0. Type String Describes the type of event that occurred. Often used for routing, observability, and policy enforcement. Data content type String Content-type of the data value. Enables data to carry any type of content. Data schema String URI that identifies the schema that the data adheres to. Subject String Describes the subject of the event in the context of the event producer. For information about these fields, see the CloudEvents context attributes.
Save the new entry.
Configure target Google Cloud services
You can use this setting to maintain the target Google Cloud services for your events.
This setting is used when publishing events from SAP to Google Cloud services using the Business Eventing Toolkit for SAP.
To configure target Google Cloud services, do the following:
In SAP GUI, execute the transaction code
/GOOG/SDK_IMG
.Alternatively, execute the transaction code
SPRO
, and then click SAP Reference IMG.Click ABAP SDK for Google Cloud > Basic Settings > Business Eventing: Configure Google Cloud Targets for an Event.
Click New Entries.
Enter values for the following fields:
Field Data type Description Event Key String Specify a name of the publisher event configuration. For Example, EVENT_KEY. Event Processor Class String Specify the processor class for the event. Select one of the following options depending on your target Google Cloud service:
-
/GOOG/CL_PUBLISHER_PUBSUB
: For publishing events to Pub/Sub. -
/GOOG/CL_PUBLISHER_CLOUDFUNC
: For publishing events to Cloud Run functions. -
/GOOG/CL_PUBLISHER_FCM
: For publishing events to Firebase Cloud Messaging (FCM). -
/GOOG/CL_PUBLISHER_CONNECTORS
: For publishing events to the Integration Connectors API.
Google Cloud Key Name String The client key that you've configured for authentication to Google Cloud during the authentication setup. Event Parameter 1 String Specify any additional attribute that is required for the target Google Cloud service that you want to use. Event Parameter 2 String Specify any additional attribute that is required for the target Google Cloud service that you want to use. Event Parameter 3 String Specify any additional attribute that is required for the target Google Cloud service that you want to use. Cloud Event Default Attribute Key String To send the event as a CloudEvent, provide the value of the corresponding default attribute key that you've configured in the Configure CloudEvent attributes section. Cloud Event: Encoding String Select an appropriate mode for encoding your CloudEvents:
- Structured: CloudEvent attributes are passed in the request body.
- Binary: CloudEvent attributes are passed into the request header.
For scenarios when you need to send raw event data directly to Google Cloud services, bypassing the CloudEvents specification, you leave this field blank.
-
Save the new entry.
Extend the publisher module
To integrate with other Google Cloud services or custom targets beyond the prebuilt targets, you can extend the Publisher module by creating your own implementations.
To create a custom implementation, do the following:
- In SAP transaction
SE24
, create a new class that inherits from/GOOG/CL_PUBLISHER_BASE
. Implement the
PUBLISH_EVENT
andVALIDATE_PARAMS
methods.PUBLISH_EVENT
: Contains your custom logic for sending event data to the target. Map the input parameters, transmit the data, and populate the output structure with the target's response.VALIDATE_PARAMS
: Lets you verify that all necessary parameters are configured in table/GOOG/CE_ROUTER
. If any required values are missing, then raise an exception of type/GOOG/CX_SDK
.
When the ABAP code runs, the Publisher class reads the configurations from this table to guide the event publication process.
Configure listener for business events
To capture the events triggered due to changes to business objects, you need to configure a business events listener for each business object.
To configure a business event listener, do the following:
In SAP GUI, execute the transaction code
SWETYPV
.Click New Entries.
Specify an appropriate business object category and business object type.
Specify an event for which you want to listen and forward the event by using the Business Eventing Toolkit for SAP.
In the Receiver Type field, enter either
Google_Cloud
orGoogle
.In the Linkage Setting (Receiver) section, provide the following:
- Receiver Call: Select Method from drop-down list.
- Class Name: Enter
/GOOG/CL_BO_EVENT_FORWARD
.
Select the Linkage Activated checkbox.
Save the configuration.
Map an event listener to an event key
To map an event listener to an event key, do the following:
In SAP GUI, execute the transaction code
/GOOG/SDK_IMG
.Alternatively, execute the transaction code
SPRO
, and then click SAP Reference IMG.Click ABAP SDK for Google Cloud > Basic Settings > Business Eventing: Configure Event Listeners for Business Objects.
Click New Entries.
Enter values for the following fields:
Field Data type Description Object Type CHAR The name of the business object that you've configured in the transaction SWETYPV
.Event CHAR The name of the event linked to the business object. Name of Receiver CHAR The name of the receiver configured in transaction SWETYPV
against the combination of Object Type and Event.Event Key CHAR The name of the publisher event configuration maintained in the Configure target Google Cloud services section. Processor Class CHAR Optional. The name of the processor class where you've written any additional logic to fill the event body or extend the extension attributes This class must implement the interface
/GOOG/IF_BOR_EVNT_DATA_HANDLER
.For information about how to create a processor class, see Extend the processor class.
Save the configuration.
Default body and cloud event extension attributes
By default, the event listener relays the following attributes, which are part of the event container to the target as determined based on the Event Key:
{
"EVENT_OBJECT": "BUS2012",
"EVENT_OBJECT_KEY": "450000011",
"EVENT_NAME": "CHANGED",
"EVENT_CREATOR": "USER-ID",
"EVENT_CREATION_DATE": "20250321",
"EVENT_CREATION_TIME": "135050",
"EVENT_CREATION_TIMESTAMP": "20250321135050",
"EVENT_CREATION_LANGUAGE": "EN"
}
If the cloud events attributes are configured, then the payload structure is as follows:
{
"eventObjectType": "BUS2012", - Picked from Event Container
"eventObjectKey": "450000011", - Picked from Event Container
"eventName": "RELEASED", - Picked from Event Container
"eventCreator": "USER", - Picked from Event Container
"eventCreationDate": "20250321", -Picked from Event Container
"eventCreationTime": "135850", - Picked from Event Container
"eventCreationTimestamp": "20250321135850", - Picked from Event Container
"id": "D5D1CB352A321FD081FFF6EEA9566190", - Auto Populated
"source": "sap-s4hana-doc", - Picked from CE Defaults
"type": "pochanged", - Picked from CE Defaults
"specversion": "1.0", - Picked from CE Defaults
"time": "2025-04-09T16:16:38Z", - Auto Populated
"subject": "test-subject-A" - Picked from CE Defaults Table
}
If you create and configure a processor class in your event listener, then the resulting payload reflects your custom payload structure.
Extend the processor class
The business eventing toolkit lets you set the data and add additional extension attributes to cloud events.
To do so, implement a class that inherits the interface /GOOG/IF_BOR_EVNT_DATA_HANDLER
and implements the interface method FILL_EVENT_DATA
.
This method has the following importing and changing parameters:
Name | Type | Associated type | Description |
---|---|---|---|
SENDER |
Importing | SIBFLPORB |
Local persistent object reference: BOR compatible |
EVENT |
Importing | SIBFEVENT |
Event |
EVENT_CONTAINER |
Importing | Type Ref To IF_SWF_IFS_PARAMETER_CONTAINER | Container for transfer of parameters |
RECTYPE |
Importing | SWFERECTYP |
Name of the receiver type |
HANDLER |
Importing | SIBFLPORB |
Local persistent object reference: BOR compatible |
CT_DATA |
Changing | /GOOG/CL_PUBLISHER_BASE=>TT_MESSAGES |
Table of messages |
CT_CE_EXTN_ATTRIBUTES |
Changing | /GOOG/T_CE_ATTR_VALUE |
Cloud Event: attribute name, value pair table |
Sample implementation for business object BUS2012
(Purchase Order) to include
PO header information as cloud event body:
TYPES: BEGIN OF ty_event_attributes,
ekgrp TYPE ekgrp,
werks TYPE werks_d,
stlnr TYPE stnum,
stlal TYPE mast-stlal,
stlty TYPE stko-stlty,
END OF ty_event_attributes.
DATA: ls_po_header TYPE bapimepoheader.
DATA: ls_event_attributes TYPE ty_event_attributes,
lv_json TYPE string.
DATA ls_data TYPE /goog/cl_publisher_base=>ty_message.
CALL FUNCTION 'BAPI_PO_GETDETAIL1'
EXPORTING
purchaseorder = '4500000007'
IMPORTING
poheader = ls_po_header.
/ui2/cl_json=>serialize(
EXPORTING
data = ls_po_header
RECEIVING
r_json = lv_json
).
ls_data-data = lv_json.
APPEND ls_data TO ct_data.
Configure listener for RAP events
For each RAP event that you want to send to Google Cloud, you need to create an event handler class. This event handler class acts as an event listener for that RAP event.
To programmatically create an event handler class, you can use the community resource available on GitHub. You need to provide the RAP entity details and generate the event handler classes. For information about event objects, see the SAP documentation SAP Business Accelerator Hub.
To manually create an event handler class, do the following:
Create an ABAP class for RAP events:
- Right-click your ABAP package and select New > ABAP Class.
Enter the following details for your ABAP class:
- Name: A name for your class, for example,
ZCL_PRODUCT_EXT
. - Description: A description for your class, for example,
Event handler for RAP events
.
- Name: A name for your class, for example,
Click Finish.
Update the class definition as follows:
class CLASS_NAME definition public abstract final for events of RAP_ENTITY_NAME . public section. protected section. private section. ENDCLASS. CLASS CLASS_NAME IMPLEMENTATION. ENDCLASS.
Replace the following:
CLASS_NAME
: Name of the class, for example, ZCL_PRODUCT_EXT.RAP_ENTITY_NAME
: Name of the RAP entity, for example, R_PRODUCT.
Open the Local Types tab and create a local implementation:
CLASS lcl_event_extension DEFINITION INHERITING FROM cl_abap_behavior_event_handler. PRIVATE SECTION. METHODS on_EVENT_NAME FOR ENTITY EVENT created FOR RAP_ENTITY_NAME~EVENT_NAME. ENDCLASS. CLASS lcl_event_extension IMPLEMENTATION. METHOD on_EVENT_NAME. TRY. /goog/cl_event_publisher=>publish_event( EXPORTING iv_event_key = 'EVENT_KEY' it_data = VALUE #( FOR <ls_created> IN created ( data = /goog/cl_json=>serialize( data = <ls_created> ) ) ) IMPORTING et_output = DATA(lt_output) ). CATCH /goog/cx_sdk INTO DATA(lo_exp). "Error handling logic here ENDTRY. ENDMETHOD. ENDCLASS.
Replace the following:
EVENT_NAME
: Name of the event, for example, CREATED.RAP_ENTITY_NAME
: Name of the RAP entity, for example, ZCL_PRODUCT_EXT.EVENT_KEY
: Event key that has the target configuration.
Get support
If you need help resolving problems with the ABAP SDK for Google Cloud, then do the following:
Refer to the ABAP SDK for Google Cloud troubleshooting guide.
Ask your questions and discuss ABAP SDK for Google Cloud with the community on Cloud Forums.
Collect all available diagnostic information and contact Cloud Customer Care. For information about contacting Customer Care, see Getting support for SAP on Google Cloud.