Integration Blog Posts
cancel
Showing results for 
Search instead for 
Did you mean: 
AlexPfeil
Product and Topic Expert
Product and Topic Expert
2,330

Introduction

In today’s interconnected enterprise landscape, real-time data movement and event-driven architectures are no longer optional—they are foundational. SAP offers a powerful trio of technologies to enable this: the SAP Data Replication Framework (DRF), SAP Integration Suite – Advanced Event Mesh (AEM), and the Application Interface Framework Event Mesh Add-On (AIFAEM).

SAPa Data Replication Framework (DRF)

The Data Replication Framework is a tool used to replicate master data accurately and efficiently across SAP and non-SAP systems, ensuring data consistency and integrity through various methods such as real-time replication, scheduled batch processing, and manual replication. It utilizes technologies such as SOAP or IDocs for asynchronous outbound services.

SAP Integration Suite – Advanced Event Mesh (AEM)

AEM is SAP’s enterprise-grade event broker that supports asynchronous, decoupled communication across distributed systems. It enables real-time event streaming, dynamic routing, and scalable integration across hybrid and multi-cloud environments. AEM supports open standards like CloudEvents and integrates with Kafka, REST, and MQTT, making it a versatile backbone for event-driven architectures.

AIFAEM – The Missing Link

To bridge traditional SAP systems like ECC or even S/4HANA with AEM, SAP introduced AIFAEM—an ABAP-based add-on that extends the Application Interface Framework (AIF). AIFAEM allows you to define and expose custom business events based on the BOR (Business Object Repository) framework. These events can then published to AEM in CloudEvents format, enabling seamless integration with modern event consumers.

AIFAEM supports:

  • Event creation from both ECC (SAP NW 7.31) and S/4HANA (SAP NW 7.55 and above)
  • CloudEvents formatting and structure mapping
  • Monitoring via SAP Fiori apps and transaction /AIF/ERR
  • Out-of-the-box connectivity to AEM without consuming AIF message quotas

Why This Matters

Together, DRF, AEM, and AIFAEM form a robust pipeline for event-driven data replication. DRF ensures the right data is selected and prepared, AIFAEM transforms it into events, and AEM distributes it across your enterprise landscape. This architecture empowers developers and architects to build responsive, scalable, and loosely coupled systems that are ready for the future of integration.

Disclaimer

The clean core approach for a connection between DRF and AEM, and I would recommend to apply this pattern, would be the Usage of a Standard DRF Replications provided by SAP which target an Iflow on Integration Suite (SOAP, XI or IDoc Sender Adapter) and pass the Event to AEM using the AEM Adapter. This would be a configuration only scenario and also can be monitored with SAP Application Interface Framework. 

The pattern explained in the following is bypassing the BTP Cloud Integration, AIFAEM is connecting directly to AEM. But since DRF does not support a REST connection, AIFAEM has to be involved and therefore a custom ABAP Class is required. Keep in mind that in my example the custom class is quite huge, because it is a copy of the Standard Business Partner Replication Class + adjustments for AIFAEM. Also for AIFAEM further custom objects are required (Action Function Module, custom DDIC objects).

 

How it works

1) DRF Customizing & Custom DRF Class

The Standard Object we are trying to use is 986 - Business Partner. You´ll find it in DRFIMG -> Enhance Default Settings for Outbound Implementations -> Define Business Objects

AlexPfeil_0-1752844083494.png

The corresponding Outbound Implementation (using the Standard SOAP Proxy ) is 986_3.

Since we don´t want to use SOAP, but still want to utilize the Object itself, we need to define a custom Outbound Implementation. This though does not work with 986, that is why I needed to copy 986 to Z_986:

AlexPfeil_1-1752844968727.png

Then we copy the Outbound Implementation 986 to the custom Outbound implementation Z_986_3

AlexPfeil_2-1752845066963.png

The logic behind the Outbound implementation is in a Class using the methods of interface IF_DRF_OUTBOUND. For 986_3 it is CL_MDG_BS_BP_REL_SERVICE_DRF

AlexPfeil_3-1752845179049.png

This class also needs to be copied into a Z-Class. For Z_986_3 I created Z_CL_DRF_2_AIFAEM_BP_REPL:

AlexPfeil_4-1752845305093.png

The class is referencing itself in the Constructor method. This needs to be changed to the new Z-Class. I have uploaded the Z-Class to my Github Repo here.

In IF_DRF_OUTBOUND~SEND_MESSAGE we have the Proxy Call

 

lo_bp_bupa_outbound->exec_async_out

 

Here in the parameter lt_bs_bp_data the Business Partner data is passed to the Proxy Method. Unfortunately not in the Format of the Outbound SOAP Interface, but Data Type mdg_bs_bp_t_extern .

AlexPfeil_5-1752846127701.png

With the "Where Used List" of this Data Type and Search (STRG + F) for "Map" I could find the Method CL_MDG_BP_BUPA_SI_OUT->DO_MAPPING_OUTBOUND. So I removed the Proxy Call and added the mapping and AIF Call

AlexPfeil_6-1752846151163.png

see Line 1158 in the Z-Class in the Github Repo mentioned above.

Now we are passing Data Type mdg_bp_bpsuitebulk_rplct_req_m to AIF. This is the Proxy Message type.

Of course our Outbound Implementation needs to be assigned to a Replication Model

AlexPfeil_14-1752846758693.png

This also needs to be activated on "Define Replication Model" Level.

 

2) AIF Customizing

For AIFAEM we need a Target Data Type with "CONTROLLER" and ""Since we are using a Proxy Data Type, we cannot design the Data Type in SE11, it has to be done either in SAP PO (ESR) and generated or in SPROXY. I decided to go with SPROXY.

  • SPXNGENAPPL -> Define Namespace for your Data Type
  • SPROXY -> Create -> Data Type. Here we need to reference the Data Type from the Standard Interface

Standard Proxy:

AlexPfeil_7-1752846350861.png

Custom Proxy:

AlexPfeil_8-1752846365052.png

In the Internal View we see the Name of the ABAP Structure we can use in AIF Interface Definition

AlexPfeil_9-1752846409310.png

Since Proxy Structures already use "CONTROLLER" Tables, we cannot name our AEM Controller Structure this way. This is why it is called CONTROLLER1.

Creation of  AIF Interface

Raw Structure = Structure passed from DRF to AIF

SAP Structure = Structure passed from AIF to AEM

AlexPfeil_10-1752846451273.png

AIF Structure Mapping:

AlexPfeil_11-1752846474935.png

Static topic. Can be adjusted to dynamic if needed.

AlexPfeil_12-1752846486996.png

Move-Corresponding, so we don´t have to map the individual Fields

Action:

AlexPfeil_13-1752846512712.png

Since we cannot use "CONTROLLER" which is needed in AIFAEM Standard Action, we need a Custom DRF Action, which is essentially a copy of the Standard Action, but with CONTROLLER1 referenced instead of CONTROLLER --> see Github Repo here 

 

Test

Let´s say i want to replicate this BusinessPartner:

AlexPfeil_3-1755253568713.png

 

Testing in DRFOUT:

AlexPfeil_16-1752846855828.png

--> manual Filter criteria

AlexPfeil_0-1755252938493.png

 

Success in the Logs:

AlexPfeil_0-1755253994546.png

 

/N/AIF/ERR

AlexPfeil_1-1755253075475.png

 

I consumed the topic in SAP Cloud Integration:

AlexPfeil_2-1755253497704.png

 

That´s it! Happy Eventing!