Show TOC Start of Content Area

Function documentation GlobalContainer Object  Locate the document in its SAP Library structure

Use

This object enables you to cache the values that you want to read again when you next call any user-defined function in the same message mapping. Note that the sequence in which user-defined functions are called is predefined. It depends on the position of the target fields that the function was assigned to.

Note

Imagine a target structure in the mapping editor in which all the structure nodes have been expanded. The fields are processed from top to bottom, starting at the root node.

Furthermore, in the same as for the Container object, you can also access the fields of the message header by using the GlobalContainer object.

Integration

To get a global container object, call the getGlobalContainer() method for the Container Object.

Features

Methods of the GlobalContainer Object

Method

Use

void
setParameter
(String parName, Object obj);

Saves the obj object under the parName name in a global container, which can be accessed by all user-specific functions of a message mapping.

Object
getParameter
(String parName);

Returns the object that was saved under the parName name in the global container by using the setParameter method. If no such parameter exists, getParameter returns null.

Map getParameters();

Returns a Map for accessing fields of the message header. You access the fields in the same way as described in the example in Container Object.

Example

The following example only details the use of getParameters(). The source code queries the INTERFACE_NAMESPACE constant in a user-defined function and returns it as a result of the function:

GlobalContainer globalContainer;

String headerField;

java.util.Map map;

// To get a global container, use method getGlobalContainer()

// of the container object

globalContainer = container.getGlobalContainer();

// There are two ways of getting the runtime constant map now:

// a) by calling container.getTransformationParameters() or

// b) by calling globalContainer.getParameters().

map = globalContainer.getTransformationParameters();

// get the value for a header field

headerField = (String) map.get(

                StreamTransformationConstants.INTERFACE_NAMESPACE);

// output value return it

return headerField;

At design time, the mapping runtime constants do not yet have any values. Therefore, the mapping editor only displays a test string for each constant in the test environment.

See also: Special Access to Mapping Runtime Constants.

 

 

End of Content Area