In all xi project I worked on, lookup operations in message mapping were always an important issue with the risk to become a bottleneck. A possible solution is to use the library I developed to manage mapping lookups. The library provide a common point of access to any remote lookup function module, and provide a cache mechanism to store each result and avoid to repeat identical lookups within the same message mapping. Prerequisite
- The system providing data lookup is a SAP system or it is able to expose a function module.- Function modules to be called are remote enabled.- The type of importing and exporting parameters of the function modules is char.How the library works
1 Internal logical flow of the Lookup LibraryHow to use the library in your Message Mapping
Step 1: In the Integration Directory create an RFC Receiver Communicational Channel to the System that contains lookup function modules.Step 2: Import DataLookupOptimized.jar into Integration Repository (SWCV -> Your Namespace -> Mapping Objects -> Imported Archive)Step 3: In the graphical mapping editor create a simple function and import the package it.techedge.sap.xi.utils.datalookupStep 4: Retrieve the data look up provider object from the globalContainerStep 5: Create the list of parameters to be provided to the RFC:Step 6: Execute the data look up by calling the method provideDataLookUp with the following parameters:- String systemName: name of the system that exposes the RFC;- String remoteFunctionName: name of the remote function that resolve data look up;- String outputFieldName: name of the output field to be retrieved (the RFC can return more than one output value);- ArrayList rfcParams: array of params to be provided to the RFC. Note that the order of parameters in the array must respect the order defined in the RFC. If a parameter is not provided the value null must be added to the array.The method returns a String corresponding to the RFC exporting parameter named outputFieldName.Step 7: Store the dataLookUpProvider object in the global containerExample
In this example a data look up is performed to retrieve the FLIGHT_DESCRIPTION_SHORT associated to the field FLIGHT_CODE of the outbound message interface.RFC details:- Name: Z_FLIGHT_CODE_TO_DESCRIPTION- Importing parameters - FLIGHT_CODE - LANGUAGE- Exporting - FLIGHT_DESCRIPTION_LONG
- FLIGHT_DESCRIPTION_SHORT
Mapping:2- Mapping Overview using Lookup UDFUser defined function:- Name: transcodeCodeToFlightDescription
- Parameters:
- SystemName(String): BS_EP1CL010
- remoteFunctionName(String): Z_FLIGHT_CODE_TO_DESCRIPTION
- outputFieldName(String): FLIGHT_DESCRIPTION_SHORT
- flightCode(String): flight code from outbound interface
- languageCode(String): language code from outbound interface
- container(container, automatically added)
-Imports: it.techedge.sap.xi.utils.datalookup
3 Lookup User Defined Function CodeLookup User Defined Function Code Snippet
Reference
You can download my library here.The library is based on SAP Lookup Library API:https://help.sap.com/javadocs/NW04S/SPS09/pi/index.htmlSpecial thanks to my colleagues Sandro Garofano and Sergio Cipolla, with their suggestions they really helped me.