Skip to Content
Author's profile photo Former Member

Alerts from adapter modules – the JRA way!!

We had a requirement in our project for raising alerts from adapter modules for receiver file communication channels. The business requirement behind this was to inform the concerned business people about the business data rejected during validation and we chose adapter modules for doing this, it being the last but one piece of code that will be executed before the file would be written by the file adapter.

Though I suspected it would not work, and eventually it didn’t, I thought of initially trying it out with Mapping LookupAPI. And this was the error it threw. Internal lookup service is not registered.
Invoking the lookup service is only supported in the Integration Builder test environment or in the Integration Server runtime environment.

And the code line which caused this was

Channel channel = LookupService.getChannel(“BS_XXX”, “CC_XXXX”);

So, we had a tough task of finding a solution for calling this RFC to raise alert from the adapter module environment, in pure J2EE terms, the EJB environment. Again the requirement was to have efficient connectivity mechanism i.e. connection pooling in place so that the client application does not connect / disconnect at its own but just picks up a connection from a pre-established pool of connections and releases it to the pool when done with its execution. Here came SAP JRA into picture which is a SAP recommended way of accessing SAP systems from a J2EE runtime environment and is an add-on for SAP JCo. For more information about SAP JRA refer the following link.


For raising alerts from adapter modules, which run inside the adapter engine of XI, the RFC SALERT_CREATE on XI server needs to be executed with the relevant information passed to it. Thanks to Bhavesh Kantilal for his Triggering XI Alerts from a User Defined Function for pointers to this RFC.

The code for raising the alert , or in general calling any RFC using JRA follows a typical pattern of
1. Retrieve the initial context
2. Lookup for the ConnectionFactory by the JNDI name which the administrator will set while configuring SAP JRA. Retrieve a connection from this connection factory.The connectivity parameters i.e. User Credentials,System ID,Client etc. are a part of JRA configuration and need not be passed from the code.
3. Retrieve the metadata for the RFC to be called. Note that NO JCO specific classes are to be used.
4. Set any direct import parameters, tables and call the RFC using interaction and execute the call.

Having your JRA configuration in place you can use the following code for raising alerts from adapter modules. Assuming you have an alert category ALRT_CAT with containers CONT_1 thro’ CONT_N, this would be a typical process method of your module.

Watch out for the part II of this blog with specifics about JRA setup and the NWDS project settings you need to do to run this code successfully.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Bhavesh Kantilal
      Bhavesh Kantilal
      Good blog. Waiting for the part II of this blog for the JRA setup.


      Author's profile photo Former Member
      Former Member
      Hi Amol,

      Nice blog In my project I am executing the FM and getting record in return .

      How to convert MappedRecord output to individual records any suggestion