Show TOC

Container ObjectLocate this document in the navigation structure

Use

This object enables you to cache the values that you want to read again when you next call the same user-defined function from the same context. An instance of the container object is transferred to each user-specific function by using the container parameter.

Integration

When using the container object, you do not just temporarily save values for a user-defined function, you also access the following objects as well:

  1. AbstractTrace object to write messages to the trace.

  2. GlobalContainer object to exchange values between different user-defined functions.

  3. Map object to access mapping runtime constants.

The following figure shows how the GlobalContainer and Container objects access mapping runtime constants.

Figure 1: How the GlobalContainer and Container Objects Access Mapping Runtime Constants
Features

Methods of the Container Object

Method(s)

Use

void setParameter (String parName, Object obj);

Saves the obj object under the name parName in a container for a user-specific function.

Object getParameter (String parName);

Returns the parameter that was saved under the parName name in this user-specific function by using the setParameter method. If no such parameter exists, getParameter returns null .

AbstractTrace getTrace();

Returns a AbstractTrace Object with which you can transfer messages to the mapping trace.

GlobalContainer getGlobalContainer();

Returns a GlobalContainer object with which you can save the values that can be read by any user-specific functions in the same message mapping.

java.util.Map container.getTransformationParameters()

Returns a map with the mapping runtime constants. For a description of which constants you can access by using this map, see Java-Mapping-API (SAP NetWeaver 2004 und 7.0) . The constants are attributes of the class c om.sap.aii.mapping.api.StreamTransformationConstants (also see the example below).

Example

The following source code queries the constant INTERFACE_NAMESPACE in a user-defined function, displays it as information by using the AbstractTrace object and returns it as a result of the function:

AbstractTrace trace; String headerField; java.util.Map map;

trace = container.getTrace();

// get constant map map = container.getTransformationParameters();

headerField = (String) map.get( StreamTransformationConstants.INTERFACE_NAMESPACE); trace.addInfo("INTERFACE_NAMESPACE:" + headerField);

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.

More information: Special Access to Mapping Runtime Constants .