Start of Content Area

Function documentation Advanced User-Defined Functions  Locate the document in its SAP Library structure


Advanced user-defined functions can access more than just individual field values. Instead, you can import a complete context or an entire queue for a field as an array before your function is called. This enables you, for example, to perform calculations on all field values of a context as well as to divide up the contexts themselves further by inserting context changes.


When the instance for a source structure is parsed, a message mapping works with queues.

This graphic is explained in the accompanying text

There is a queue for each hierarchy level. A queue can have the following entries:

Possible Queue Entries



(empty string)

This is a queue for a structure field. In the queue there is an entry with an empty string each time the field appears in the XML instance. In the example above there is such a queue for <A /> and <root />.


Value of a value field


Constant that shows a context change


Constant that causes a field and its subnode to be ignored during processing

(empty context)

Context that does not contain any values (see the graphic below).

You can create special structure mappings by adding or removing context changes. The standard functions SplitByValue() and removeContexts() work by this principle.

See also: Structure Mappings by Setting the Context.

The following basic rule applies for nested structures: The number of contexts of a queue must be the same as the number of values (empty strings) of the upper-level queue.

This graphic is explained in the accompanying text


Advanced user-defined functions can import either just one context into the input arrays, or complete queues. You define this using the execution type in the function properties of a function:

Working with Contexts or Queues

Execution Type


All Values of Context

Advanced functions that only import one context do not have an identifiable context change. You can of course insert a context change into the results list.

All Values of Queue

Since one or more entire queues are imported in this case, this option is more memory-intensive and is not suitable for very large messages.

The input arrays do not contain the context change at the start and end of the context (or the queue). These context changes are implicitly always available and cannot be identified or deleted from the user-defined function.



End of Content Area