Thursday, November 20, 2014

SAP XI - Event based message triggering with dependencies

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 

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


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.


No comments:

Post a Comment