In one of our projects, one functionality was to post Audit messages to an external JMS service for all interfaces running through XI. We had a very large volume of data and planned to avoid a BPM. We therefore, decided to go ahead with using a JMS API to post the Audit messages to the JMS service.
One problem with this approach was what happens if the JMS service goes down?
As we were not using a BPM and were publishing the JMS message using the JMS API from within our mapping, we had 2 options when the JMS service was down.
1.Abort the entire process and thereby prevent a valid Business process from happening in XI.
2.Abort the JMS audit message and continue with the Business Process.
We decided to go with the 2nd approach, but we also wanted a mechanism to intimate the operations support team that the JMS service was down. If we had gone for a BPM, it would have been easy and simple to just use a Control Step to achieve this functionality. Since we were not using the BPM, we had to duplicate the functionality of the exception branch->control step of the BPM. We had to trigger Alerts from within our Message Mapping.
There is an RFC SALERT_CREATE which can be used to trigger Alerts (Thanks to Alessandro Guarneri for pointing me in the right direction and Anand Torgal for helping me understand this RFC module with his ABAP expertise.). So, perform an RFC Look Up using the LookUp API and call this RFC module to trigger the Alert from the UDF.
The Function Module (RFC SALERT_CREATE) in SE37:
Input Parameters to the RFC:
1.IP_CAT – Alert Category created in ALRTCATDEF ( ALRTFRMWRKTEST)
2.IT_CONTAINER – This is used to fill up the Container Variables.
- ELEMENT – The name of the container variable. (DOCNUMBER)
- ELEMLENGTH – Length of the Element (250)
- TYPE – Type of the Container variable ( C for character)
- VALUE– Value to be passed. (12345)
The code in the User Defined Function:
We write the code to perform the RFC Look up, wherein we trigger the RFC SALERT_CREATE by using the RFC Look up API.
We brought down our JMS service and the Alert was triggered successfully, and the business flow of the interface continued without any hassles. The Container variables were filled up with the value provided in the UDF. (12345 in our case).
In real time, one can fill up all container variable values like Message ID, Sender Service , Receiver Service , etc and pass them to the Alert from the User Defined Function.
For info on how to get the values, http://help.sap.com/saphelp_nw04/helpdata/en/b3/9a2aeb24dc4ab6b1855c99157529e4/content.htm