This feature is now available with PI 7.1. The only restriction is that the library containing the UDFs has to be in the same Software Component Version (SWCV) as the message mapping. Therefore, if we wish to share the library in more than 1 SWCV, then we will need to create dependencies in the System Landscape Directory (SLD).
In this blog, I will discuss how to created and use UDFs that can be shared with multiple message mappings.
For demostration purposes, I will create a UDF to calculate the factorial of a number in a function library. Then, use this function library’s UDF in a message mapping.
Below is the simple procedure:
- Create a Library and an User-Define Function to be shared.
A Function Library can be create in any namespace under a SWCV. The Function Library, then, can be referenced from any namespace under the SWCV.
I am going to create a function library in the namespace, http://test.com/shared, called “myUdfLibrary”.
The following screen will appear. Then, follow the procedure below:
- Click on the “+” in “Functions and Java Area”.
- Enter the function name, “ComputeFactorial”.
- Enter “ComputeFactorial” as the Title.
- Enter the java code.
- Save and Activate.
- Use the User-Defined Function in the Function Library.
Here, we are just going to do a simple one-to-one mapping, and use the UDF to compute the factorial. But, first, we will have to reference the function library.
With the following screen.
- Click on the “+” in “Used Function Libraries”.
- Click on the “down arrow” to select the function library from the value list.