Most of us already started using/exploring PI 7.1 and there are few blogs already discussing about its features and use cases. For this who are Newbie to PI 7.1, read this Process Integration Handbook.
PI 7.1 being new, I started my first Blog on it with SAP PI 7.1 iGoogle Gadget and this time I will discuss about the Function Library of PI 7.1.
This Blog is organized into two parts and in this 1stPart I will explain about Creating, Using and Migrating to Function Library. In the Second Part of this Blog I will explain on how to migrate the UDF’s that are there in the Message mapping to a Function Library with a Tool that I have created.
Until PI 7.0 all the UDF were local to the Message Mapping. However in Business Scenarios we would require the same UDF to be used in different Message Mapping which we achieved by copy-pasting the same to the new Message Mapping. This overhead of copy-pasting the reusable UDF’s is thrown away by using the Function Library in PI 7.1. A Function Library is a Repository(ESR) object to create UDF and make it globally accessible i.e. to use it across any Message Mapping within a Software Component Version.
Creating Function Library.
Function Library is created like all other objects in ESR. It is organized under Mapping Objects when we do a Right click ànd select New in ESR object.
Following picture and the below explanation describes about the Function Library object structure.
1. Functions and Java Area:
All the UDF are created and organized here.
Declaration of Global Variables/attributes, Methods declaration & definitions are maintained @ Attributes and Methods.
2. All the Imports are maintained in the Import Instructions Table and any additional Java classes used are organized in Archives Used Table.
3. Execution Type of the UDF and the Variable/ Parameter to it are maintained here.
4. Java code is written here.
Using Function Library.
Once Function Library is saved and activated you can use it any of the Message Mapping that resides in the same Software component version. To use the Function Library in the message mapping open/expand the Used Function Library section (Left side to the Data Flow Editor) and add the Function Library as shown below.
1. Function Library used in a Message Mapping is maintained here.
2. Function Library name should be selected from the Functions dropdown box to use the Global UDF in MM.
For Step-by-Step process of creating and using Function Library read this blog SAP PI 7.1 Mapping Enhancements Series: Share User-Defined Functions.
Migrating UDF of Message Mapping to Function Library using Import Source Text:
This is standard functionality to copy the source code of the UDF in the message mapping to a Function Library. Follow the below steps to migrate UDF to FL.
1. Open the Message Mapping, Navigate to Function Tab and click on button Export Source Text. A folder is created in the selected location with the source java code in the path mapping class name > com > sap > xi > tf > .java file
2. Open the Function Library and create all the UDF properties like UDF Name, Execution Type and Signature Variables/UDF Parameters.
3. Click on Import Source Text button as shown below and navigate to Java code file that was created in step 1 and import.
This Import Source text scans the input Java code only for those functions that are created/entered in Step-2. The remaining function codes are ignored. So it is very important to create the function name and parameter, same as it is in the Message Mapping before Importing Source Text.
Hope this was an Informative Blog for the beginners. In the next blog I would explain on migrating the existing UDF from Message Mapping to Function Library using My tool PI Function Library Migrator.