Start of Content Area

Function documentation Function Overview and Function Properties  Locate the document in its SAP Library structure

Use

In a (local) function library you work with the function overview on the left-hand side of the editor to access the function properties of existing functions on the right-hand side of the editor, or to create new functions.

Integration

The function overview does not display the functions of other Java packages or other function libraries.

Prerequisites

You have already created a function library, or a message mapping or a mapping template with a local function library. These object types support the functions described here in the same way.

Features

Predefined Functions and Java Areas

The function overview displays all functions and Java areas of the library. Once you have created a function library the following entries are already in the list:

Attributes and Methods

This area corresponds to the class body of the Java class. You can define global variables and global methods of the library in this area.

init

Initialization method that is called before message mapping.

cleanUp

Method that is called after message mapping, for example, to release data in the memory that is no longer needed.

If you use multiple function libraries in a message mapping, there are several Java area Attributes and Methods, and several init()and cleanUp() methods. The mapping runtime executes this source text at the beginning or end of the message mapping in the sequence in which you have entered the corresponding function libraries in the table for using the libraries.

Properties of User-Defined Functions

To add a new function, you add a new line in the function overview and assign a technical name for the function. You specify the remaining properties of the function on the right-hand side by using the source text editor:

Function Properties

Property

Use

Title

Title for the function display in the data-flow editor

Description

Description for the quick info text of the function in the data-flow editor

Execution Type

Single Values

A function with this execution type can process single values of fields in each call.

All Values of Context

A function with this execution type can process multiple input values of a field in each call. The mapping runtime assigns all field values of a context to the fields of the corresponding array before the function call.

See also: Advanced User-Defined Functions

All Values of Queue

A function with this execution type can process multiple input values of a field in each call. The mapping runtime assigns the values of the entire queue for the field to an array before the function call.

See also: Advanced User-Defined Functions

Note that when dealing with large messages, saving the entire queue in the cache requires a lot of memory at runtime. In such cases, it is therefore better to work with contexts.

Category

Function category under which the function is to be found in the data-flow editor. To assign a function to an existing category, enter its name. To assign the function to a new category, assign a name that does not already exist. The mapping editor then automatically creates a category with this name.

Signature Variables

Possible Java Types

Argument

Variable type for the input values of a function that are usually displayed as boxes on the left side of the data-flow editor.

String, int, float

Parameter

Variable type for function parameters that you use to control the behavior of the function, independently of the arguments. To give the parameters values, double-click the function in the data-flow editor to call the function parameters.

You also have the option of binding the function parameters to message mapping parameters (see: Parameterized Message Mappings).

String, int, Channel

Result

Variable type for all execution types other than single values. You use the results variable declared using this type to return the results queue of the function (see also: ResultList Object).

ResultList

Data Type Conversions

The mapping runtime reads the values of fields from the message as a string. If you have entered int or float as the variable type for the arguments, the runtime executes a data type conversion when the values are assigned. If the string cannot be converted to the specified data type, the mapping runtime triggers an exception.

Activities

...

       1.      To create a new user-defined function, add a new line in the function overview and enter its function properties.

       2.      Enter your source text (see also: Implementing Java Functions).

 

 

 

 

End of Content Area