
Using User-Defined Functions
Use
If the standard functions for a target field mapping do not fulfil your requirements, or if the graphical representation becomes unclear due to the complexity of the mapping, you have the option of creating your own user-defined functions. Within this function you can compile Java source text and use Java programs from imported archives with the same namespace and software component version as the message mapping. You can then insert the function in the data-flow editor by using the function category User-Defined, just like a
standard function.

A Java method is generated within the message mapping for user-defined functions.
Prerequisites
You have created a message mapping and have loaded an XML structure for both the source and the target structure.
Procedure
To create a new user-defined function, choose Create New Function (
) in the data-flow editor at the bottom of the screen, on the left-hand side.
Specify the attributes of the new function in the subsequent window:
- Label
:
Text that appears in the function chooser and on the data-flow object to identify the new function.
- Name
:
Technical name of the function.
- Argument Count
:
The number of input values that should be transferred to the function.
- Description
:
Description of the function’s use.
- In the subsequent window you can create Java source code:
- To import Java libraries, enter them in the Imports input field. You can also access all standard JDK and J2EE libraries without making any specifications in this input field. You can use imported Java classes here that are located in the same namespace as the message mapping.
- Create your Java source text in the editor window or copy source text from another editor.

All functions have the return value of type
java.lang.String (also see the General section in standard functions).
- Choose OK to confirm.
- User-defined functions are limited to the message mapping in which you created the function. To save the new function, simply save the message mapping.
- To test the new function,
test the message mapping.
Result
The new function is now visible in the User-Defined function category. When you select this category, a corresponding button is displayed in the function chooser. To edit, delete, or add the function to the data-flow editor, choose the arrow next to the button and select from the list box is displayed.