Start of Content Area

Background documentation Special Access to Mapping Runtime Constants  Locate the document in its SAP Library structure

Key-Value Pairs

In some mapping programs it may be necessary to access fields in the message header. For this purpose, the mapping runtime saves the field values as key-value pairs.

Examples of Key-Value Pairs in the Map for Runtime Constants

Key

Value

MessageClass

ApplicationMessage

ProcessingMode

synchronous

ReceiverNamespace

http://com.sap/xi/example

The keys are derived from the field names of the fields in the message header.

Access Using String Constants Instead of Keys (Standard Case)

To be able to read the fields of the message header at runtime, you must access the map for the runtime constants. However, if you were to access the map by using the keys specified above and one of the keys were to change, the program code would be rendered invalid. For this reason, the mapping API provides string constants that can be used to access the map in place of the keys.

String Constants for Accessing the Runtime Constants in the Map

String Constant

Key

MESSAGE_CLASS

MessageClass

VERSION_MAJOR

VersionMajor

VERSION_MINOR

VersionMinor

PROCESSING_MODE

ProcessingMode

MESSAGE_ID

MessageId

REF_TO_MESSAGE_ID

RefToMessageId

CONVERSATION_ID

ConversionId

TIME_SENT

TimeSent

INTERFACE

Interface

INTERFACE_NAMESPACE

InterfaceNamespace

SENDER_PARTY

SenderParty

SENDER_PARTY_AGENCY

SenderPartyAgency

SENDER_PARTY_SCHEME

SenderPartyScheme

SENDER_SERVICE

SenderService

RECEIVER_NAME

ReceiverName

RECEIVER_NAMESPACE

ReceiverNamespace

RECEIVER_PARTY

ReceiverParty

RECEIVER_PARTY_AGENCY

ReceiverPartyAgency

RECEIVER_PARTY_SCHEME

ReceiverPartyScheme

RECEIVER_SERVICE

ReceiverService

MAPPING_TRACE

MappingTrace

How the access works varies according to where you want to query the runtime constants:

·        Within a Java mapping you must implement a method setParameter to be able to access the map. See the example under Java mapping.

·        Within a user-defined function of a message mapping, you can access the map either by using the method getTransformationParameters() of the container object or by using the method getParameters() of the GlobalContainer object. See: Container Object.

Accessing the Runtime Constants by Using Keys (Special Case)

In certain exceptional and unavoidable cases, it may be necessary to use the keys to access the fields in the message header. This is always the case when you want to access the contents of the map by means of a variable. In the example below, a variable key key, which is to be used to read a field in the message header, is transferred to a user-defined function of a message mapping. You can only use a variable to access the map if the variable has the name of the key as its value and not the name of the string constant.

String headerField;
java.util.Map map;

// get runtime constant map

map = container.getTransformationParameters();

// get value of header field by using variable key

headerField = (String) map.get(key);

For example, to read the message ID from the message header, the variable key must have the value MessageId and not MESSAGE_ID.

 

 

 

 

 

 

End of Content Area