Entering content frameProcedure documentation Using User-Defined Functions Locate the document in its SAP Library structure

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.

Note

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

  1. To create a new user-defined function, choose Create New Function (This graphic is explained in the accompanying text) in the data-flow editor at the bottom of the screen, on the left-hand side.
  2. Specify the attributes of the new function in the subsequent window:
  1. In the subsequent window you can create Java source code:
    1. 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.
    2. Create your Java source text in the editor window or copy source text from another editor.

Note

All functions have the return value of type java.lang.String (also see the General section in standard functions).

  1. Choose OK to confirm.
  2. 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.
  3. 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.

 

 

 

 

Leaving content frame