SAP XI - Event based message triggering with dependencies

In this scenario, two interfaces to a legacy system to ECC (Enterprise Central Component) were interdependent. That is, mapping for interface B cannot start unless interface A has been successfully completed. Mapping for interface B uses RFC lookup and transformation shouldn't start unless the IDOCs for interface A have been successfully posted in ECC.

We had a scenario in which two interfaces (say interface A and B) from a legacy system to ECC (Enterprise Central Component) were interdependent. That is, mapping for interface B could not start unless interface A had been successfully completed. Both interfaces used outbound JDBC adapters and inbound IDoc adapters. Mapping for interface B used RFC lookup and transformation couldn’t start unless the IDocs for interface A have been successfully posted in ECC.

To achieve this we needed to trigger an event in ECC after posting the IDocs for interface A successfully, and this event would in turn act as a trigger for starting the transformation process for interface B in XI. However, we all know, sender adapters in XI can only poll data at regular intervals. From SP19 (NW2004s SP10), the adapter engine can support scheduled polling but cannot handle event based triggers. Integration engine supports event based scheduling of messages (link) and we used this with a slight twist for implementing our scenario, as explained below :-


Step 1: Configure Sender ID for Interface B in SXMB_ADM (in XI)

To stage the messages of interface B sent by the adapter engine in the integration engine, we needed to create a sender ID first.


Step 2: Configure event-controlled message processing for interface B in SXMB_ADM (in XI)

Here, we configured the event based message processing for interface B and assigned a job ID for the filter (in this case Z_TRIGGER_INTERFACE_B).


After saving and activating the filter, a job with status “to-be scheduled” was created.


Note: Don’t schedule or activate the job from here. We will do the same as in step 3.

Step 3: Create a job in SM36 with the same ID provided in step 2 (in XI)

In this step, for better control on the job, we used SM36 to create the same.

a. Job ID should exactly be the same as in step 2 (in this case Z_TRIGGER_INTERFACE_B).


b. Job should execute program SXMS_START_JOBS as the first step.


c. Start condition for the job should be “After Event” for custom event ‘Z_INT_B_TRIGGER’ and should be 'periodic'.


Note: Use transaction code SM64 to create a custom event.

Step 4: Create a wrapper function module for BP_EVENT_RAISE to enable RFC (in XI)

The standard function module BP_EVENT_RAISE can be used for triggering events. However, the idea is to call this function module from ECC through RFC. Hence, we created a wrapper function module namely Z_ BP_EVENT_RAISE which will in turn call standard function module BP_EVENT_RAISE.

Step 5: Create a job in SM36 for posting the IDocs and triggering the event in XI (in ECC)

This job has two steps.

   1. First step calls program RBDAPP01 which will post IDocs for Interface A.

   2. Second step calls a Z program which in turn will call function module Z_BP_EVENT_RAISE in XI using RFC, with EVENT_ID parameter as 'Z_INT_B_TRIGGER' in this case.


Now, we have established an event-based message processing where mapping for interface B will start in XI only after IDocs for interface A have been posted completely in ECC. The whole process is summarized in the below picture.


Krishnakumar RamamoorthyKrishnakumar Ramamoorthy has over seven years of experience in SAP related developments.

This content is reposted from the SAP Developer Network.
Copyright 2007, SAP Developer Network

SAP Developer Network (SDN) is an active online community where ABAP, Java, .NET, and other cutting-edge technologies converge to form a resource and collaboration channel for SAP developers, consultants, integrators, and business analysts. SDN hosts a technical library, expert blogs, exclusive downloads and code samples, an extensive eLearning catalog, and active, moderated discussion forums. SDN membership is free.

Want to read more from this author? Click here to read Krishnakumar Ramamoorthy's Weblog. Click here to read more about SAP Exchange Infrastructure (XI) on the SDN.

Dig Deeper on SAP Cloud Platform