Creating Local Functions 
You use this procedure to create local function when the standard functions for a target field mapping do not fulfill your requirements, or if the expression becomes unclear due to the complexity of the mapping, you have the option of creating your own user-defined functions, also known as Local Functions.
You can create Java source text in this function, and it is saved in a local function library for the message mapping. The function is included in the Java coding that is generated for the message mapping as a Java method; it is visible in the expression editor by using Java method name just like a Standard Function.
Create a user-defined function.
.
If you want to reuse the function in more than one message mapping, save the function in a local function library belonging to the mapping object.
Note
For more information about saving user-defined function in function library see Defining a Function Library
The function libraries are independent of a message mapping.
To use the user defined functions in message mapping, implement your function in either a local or an independent function library.
Access your user-defined function in the expression editor.
Test your function in the test environment.