Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Introduction:

In an XI mapping, it is a common requirement to be able to perform data lookups. Earlier the lookup functionality was achieved using JDBC/JCO API’s in an advanced function to connect to DB/ SAP System respectively. If the lookup were to be performed with any other application system (synchronous) SOAP/ webservice, the API’s used will change accordingly. In such a case, the developer should have the knowledge of how to integration using the API’s specific to the system. Hence the Lookup code becomes System specific.

But with SP13, using Lookup API in XI, the Lookup functionality has changed and now its even simpler. The developer need not worry about to which application system is the lookup call being made.The Lookup API’s are generic in nature which allow u to perform a lookup independent of the system to which the call is being made. Another feature to be noted is, whenever a mapping program is executed on the Integration Server, the lookup API calls the required application system by using the central Adapter Engine.

Scenario:

For the given UserName and Password details, the Role of the user has to picked up from the DB. Below is the screenshot of the DB-Table that has been used in the scenario.



Fig.1 DataBase Table Structure

Sequence of Steps:

In Configuration Time, create an appropriate communication channel to the System with which the lookup is being performed. For example, if the lookup is to be performed with a Database System, then a communication channel for the DB should be created. The Advanced function (in Message Mapping) will use this channel to perform the lookup’s.



Fig.2 Communication Channel used for Lookup

In Design Time, Create all the required design time Objects to perform a Message Mapping. (Datatypes, MessageTypes, MessageMapping).



Fig.3 Message Mapping

Create a new advanced Function to perform a DB lookup.



Fig.4 Creation of a new advanced Function



Fig.4Advanced Function editor

The following is the logical flow of code used in Advanced function that performs DB lookup.
  1. Construct your Query String
  2. Determine the channel by specifying the Party, Service, Communication channel. Or only System, Communication channel
  3. Get a SystemAccessor for the channel.
  4. Execute your Query and get the resultset.
  5. Loop through the resultset and get the required value. If you want to store more than 1 value, then use container and global container variables for storing them.
  6. Close the System Accessor


Code snippet used to perform Loopkup

Result

DB Lookup is performed when the mapping is executed.



Fig.4Output of Message Mapping

Recommended Reading

Mapping Lookups in help.sap.com gives a brief idea of how Lookup’s are performed.



45 Comments