PO JAVA Mapping 映射运行时常量

Special Access to Mapping Runtime Constants


Use

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:

  • In Java mappings you work with the get -methods of the mapping API.

  • 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 .

  • If you are still working with the SAP NetWeaver 2004/SAP SAP NetWeaver 7.0 JAVA mapping API, you must code the method setParameter within a JAVA mapping to be able to access the map. More information: Java-Mapping-API (SAP NetWeaver 2004 and 7.0) .

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.

 


  

Managing Services in the Enterprise Services Repository Special Access to Mapping Runtime Constants

Java Mapping for PI 7.1 using Abstract transformation class

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SAP爱好者

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值