0% found this document useful (0 votes)
79 views

Managing Services in The Enterprise Services Repository: Warning

This document discusses Java mapping in SAP Process Integration. It describes how to access different parts of a message within a Java mapping program using classes from the Java mapping API. It also covers implementation considerations for Java mappings, features of the runtime environment for Java mappings, and restrictions around using static variables in mappings.

Uploaded by

Sujith Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Managing Services in The Enterprise Services Repository: Warning

This document discusses Java mapping in SAP Process Integration. It describes how to access different parts of a message within a Java mapping program using classes from the Java mapping API. It also covers implementation considerations for Java mappings, features of the runtime environment for Java mappings, and restrictions around using static variables in mappings.

Uploaded by

Sujith Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

2/21/2022

Managing Services in the Enterprise


Services Repository
Generated on: 2022-02-21 12:51:50 GMT+0000

SAP NetWeaver 7.3 EHP1 | SPS30

PUBLIC

Original content: https://help.sap.com/viewer/0b9668e854374d8fa3fc8ec327ff3693/7.31.30/en-US

Warning

This document has been generated from the SAP Help Portal and is an incomplete version of the official SAP product
documentation. The information included in custom documentation may not re ect the arrangement of topics in the SAP Help
Portal, and may be missing important aspects and/or correlations to other topics. For this reason, it is not for productive use.

For more information, please visit the https://help.sap.com/viewer/disclaimer.

This is custom documentation. For more information, please visit the SAP Help Portal 1
2/21/2022

JAVA Mapping

Use
You can implement mapping programs in Java. Note that the Java mapping API only provides the framework for this, and does
not presuppose a speci c kind of implementation. To process XML documents, use Java API for XML Processing (JAXP) , for
example. The JAXP supports the Document Object Model (DOM) and the Simple API for XML (SAX) . This gives you great
exibility for mapping-programming with Java.

Implementation Considerations
Java mapping programs are not permitted to be stateful. Do not write data to a database table during a Java mapping, for
instance. The Process Integration runtimecannot track such side effects. Therefore, if an attempt is made to resend a message
that has not been received by the receiver, the data may inadvertently be written to the database twice in a Java mapping.

If you use JRE classes in your Java mapping programs then the same program restrictions apply as for Enterprise Java Beans
(EJBs). For a detailed description of these restrictions, see the relevant EJB speci cation. Also make sure you read the
information in section Features in Runtime Environment (Java Mappings) .

Features
Classes in Java Mapping API (Package com.sap.aii.mapping.api)

Class(n) Use

AbstractTransformation To implement a Java mapping program, you must de ne a class


that enhances this abstract class and then, within it's class,
implement the transform() method.

Furthermore, by using the getTrace() method in the


AbstractTransformation class, you can get a trace object of
type AbstractTrace returned (see below).

AbstractTrace To write information from a mapping program to the runtime trace,


use an object of type AbstractTrace (see: AbstractTrace Object ).
The getTrace() method in class AbstractTransformation
returns an object of this type.

TransformationInput TransformationOutput Parameter of method transform() to be implemented to access


the source message (by using TransformationInput ) and to
create the target message (output after TransformationOutput
).

You access the various different parts of the message by using the
relevant methods of these classes. An object of a type from the
following classes is then returned in each case.

InputPayload OutputPayload Object for reading from ( InputPayload ) and writing to the
payload ( OutputPayload ). You access the payload by using a
Stream ; this means that you are free to choose the actual method
of access yourself.

InputParameters OutputParameters To access the parameters of the Java mapping program, use the
methods of these classes.

See also: Parameterized Mapping Programs

InputHeader OutputHeader To read from the header elds of the source message (

This is custom documentation. For more information, please visit the SAP Help Portal 2
2/21/2022
InputHeader ) or to set the content type of the target message (
OutputHeader ), work with these classes.

DynamicConfiguration DynamicConfigurationKey Classes for read-from and write-to access to adapter-speci c


message attributes (see: Java Mapping of Adapter-Speci c
Attributes ).

InputAttachments OutputAttachments Classes, to be able to access message attachments in the mapping


program. InputAttachments allows access to attachments, that
the sender attached to the outgoing message (or messages that
were automatically moved from the payload to improve
performance (MTOM)). With OutputAttachments you can write
the attachments of the target message (there is also a method to
copy all the attachments of the outgoing message to the target
message).

The following gure gives you an overview of how to access the various parts of a message by using the parameters
TransformationInput and TransformationOutput :

Using Parameters TransformationInput and TransformationOutput

You must connect the Java mapping API to your application environment (see: Runtime Environment (Java-Mappings) ). The
runtime environment also comprises additional classes that developers can include in their implementation at required.

There are also APIs available for the following purposes:

Values mappings See: Executing Value Mappings

This is custom documentation. For more information, please visit the SAP Help Portal 3
2/21/2022
Programming lookups in mapping programs See: Mapping-Programme um Lookups erweitern

For more information about the Java mapping API, see SAP Developer Network at
https://www.sdn.sap.com/irj/sdn/javadocs (SDN user required).

 Note
You can still use the previous Java mapping API (see: Java Mapping API (SAP NetWeaver 2004 und 7.0) ).

Restrictions

Note the following points when using static variables in Java mappings:

Mappings can be executed in parallel. Therefore, several instances of a mapping may access a static eld for read or write
purposes at the same time.

If mapping programs are executed more than once, the content of the static eld may be lost. The reasons for this are as
follows:

The content of a static eld is lost if the Java class in question is reloaded. This happens after a cache refresh, for
example.

If the mapping runtime consists of a cluster, the mapping classes on each node of the cluster are loaded
separately. Each node has its own static elds.

Static elds can be used for constants and as a buffer, taking the above-mentioned points into consideration.

Runtime Environment (Java Mappings)

Use
The Process Integration runtime uses the runtime environment for Java mappings to execute Java mapping programs. In
addition to the mapping API you can use other standard libraries of the SAP JEE server in loaded Java mapping programs.

Prerequisites
You are using the SAP NetWeaver Developer Studio.

To be able to write a mapping program in your Java development environment, the Java runtime environment (JRE) of the SAP
JEE server must be consistent with the JRE version of your Java development environment.

Features
The mapping runtime environment consists of the following runtime components:

The Java runtime environment (JRE) of the SAP JEE server

The mapping API (see: Java Mapping )

sapxmltoolkit The
http://help.sap.com/saphelp_nw70/helpdata/en/36/ef353e39011a38e10000000a114084/frameset.htm contains a
JAXP implementation.

The SAP XML Toolkit will be replaced by version 5 of the Java Development Kit (JDK). More information: XSLT Mapping .

This is custom documentation. For more information, please visit the SAP Help Portal 4
2/21/2022
com.sap.mw.jco The SAP Java Connector enables ABAP-APIs to be called from the Java mapping. See the
corresponding Javadoc documentation in the SAP Developer Network at
https://www.sdn.sap.com/irj/sdn/javadocs (SDN user required).

com.sap.tc.Logging The SAP Logging Service enables integration with the Application Server Management tools.
See the corresponding Javadoc documentation in the SAP Developer Network at
https://www.sdn.sap.com/irj/sdn/javadocs (SDN user required).

Java programs that are loaded in an imported archive can use classes from the JRE, the mapping API, and these three standard
libraries.

If you use JRE classes in your Java mapping programs then the same program restrictions apply as for Enterprise Java Beans
(EJBs). This includes the following, for example (for a detailed description, see the relevant EJB speci cation):

Do not load a JDBC driver to use them directly. Instead, use the mapping lookup API (see: Mapping Lookups ), or the JDBC
Connector Service in the SAP JEE Engine.

Do not use the package java.io to write directly to les, or use it to read directly from les.

Do not use a class loader in your classes.

Within a Java mapping program, do not call java.lang.System.exit() or


java.lang.System.setProperties() .

Do not create or use any threads.

Do not use any network sockets.

Also ensure that you read the implementation considerations and restrictions in Java Mapping .

Search Path for Classes in Java Mapping Programs (Integration Server)

The mapping runtime environment is determined by the software component version and the namespace of the Java mapping to
be executed. The environment also has a speci c search sequence when loading the classes. If the mapping runtime environment
nds a class in a path, the search is terminated and the subsequent paths are ignored. The paths are searched in the following
sequence:

1. The paths of the JRE of the J2EE server

2. The path in which the mapping API is saved and the path of the standard libraries (SAP XML Toolkit, SAP Java Connector,
SAP Logging Service), see above

3. Imported archives in the same namespace and the same software component version as the Java mapping to be
executed

4. Imported archives in the same namespace and a subordinate software component version

5. Imported archives in other namespaces of the software component version

6. Imported archives in other namespaces of subordinate software component versions

7. Note that you can only load a class from the other namespaces if it is unique there.

Activities
Accessing the Runtime Environment in the SAP NetWeaver Developer Studio

Mapping API

To access the mapping API in a Java project in SAP NetWeaver Developer Studio, proceed as follows:

This is custom documentation. For more information, please visit the SAP Help Portal 5
2/21/2022
1. Choose Properties in the context menu for the Java project in which you want to apply the mapping API.

2. In the navigation tree choose Java Build Path and then choose the Libraries tab page.

3. Choose Add Variable.

4. From the list of classpath variables, select SAP_SYSTEM_ADD_LIBS and choose Extend .

5. Enhance the variable with the following path: comp SAP_XIAF DCs sap.com com.sap.aii.mapping.lib.facade _comp
gen default public api lib java com.sap.aii.mapping.api. lter.jar

For more information about the mapping API (and the lookup API it contains) refer to SAP Developer Network at
https://www.sdn.sap.com/irj/sdn/javadocs (SDN user required) and SAP NetWeaver Developer Studio:

Help Help Content SAP NetWeaver Developer Studio Documentation API Reference SAP NetWeaver 7.10 for Process
Integration comp.sap.aii.mapping.api .

Java EE Standard Libraries

To include the three J2EE standard libraries in the class path of SAP NetWeaver Developer Studio, proceed as follows:

1. Call the context menu for your Eclipse project and choose Properties .

2. Choose Java Build Path on the left-hand side.

3. Choose the Libraries tab page on the right-hand side.

4. Choose Add Variable.

5. Select SAP_SYSTEM_ADD_LIBS and choose Extend .

6. Select the required Jar le by using the following directory paths:

sapxmltoolkit

comp/ENGINEAPI/DCs/sap.com/sapxmltoolkit/_comp/gen/default/public/default/lib/java/

com.sap.mw.jco

comp/ENGINEAPI/DCs/sap.com/com.sap.mw.jco/_comp/gen/default/public/default/lib/java/

com.sap.tc.Logging

comp/ENGINEAPI/DCs/com.sap.tc.Logging/_comp/gen/default/public/default/lib/java/

Executing Value Mappings

Use
At con guration time you complete a value mapping table in the Integration Directory. In this table, values that are identical
semantically are summarized in a group.

The mapping runtime provides an API to determine a target value for a source value during a Java mapping.

Features
Source and Target Representation

This is custom documentation. For more information, please visit the SAP Help Portal 6
2/21/2022
It is possible for an object (for example, a material number) to be identi ed differently at the receiver than at the sender; in this
case, an object is said to have different representations . An object representation consists of:

A value mapping context to differentiate mappings from different applications

An agency , which manages an identi cation scheme (for example, a company)

The identi cation scheme used (for example, the scheme "customer number")

The value of the object, which is dependent on the identi cation scheme, the issuing agency, and the value mapping
context

The package com.sap.aii.mapping.value.api contains the interfaces IFIdentifier , IFRequest , and IFResponse .
You request objects for these interfaces to describe such representations. You use IFIdentifier to construct IFRequest ,
and when you execute the value mapping an object of type IFResponse is returned.

To make a value mapping request, use an object of type IFRequest . You construct the request by using a source label, a target
label (both are objects of type IFIdentifier ), and the source value. The result of the value mapping is an object of type
IFResponse , which you can use to query one or more target values in addition to the information in the request.

 Note
Alternatively, you can execute a value mapping by transferring all required values to the method executeMapping() in a
call (see below).

To make a request and execute a value mapping, you use a factory class and a service class. The methods of these classes are
described below. The interface methods consist merely of access methods for the respective values:

Methods of the Interface IFIdenti er

Method Return Value for Label

public java.lang.String getContext (); Value mapping context

public java.lang.String getAgency (); Agency

public java.lang.String getScheme (); Identi cation scheme

This is custom documentation. For more information, please visit the SAP Help Portal 7
2/21/2022
Methods of the Interface IFRequest

Method Return Value of the Value Mapping Request

public IFIdentifier getSourceIdentifier () Source label

public IFIdentifier getTargetIdentifier () Target label

public java.lang.String getSourceValue () Source value

Methods of the Interface IFResponse

Method Return Value of the Value Mapping Result

public java.lang.String getSingleTargetValue () Individual target value. If no valid target value is found, the method
returns the null value. If more than one target value is found, the
method returns the rst value (determined randomly).

To make sure that there is only one target value, use the method
countTargetValues() . To query null values, you can also use
the method hasTargetValues() .

public java.lang.String[] getTargetValues () All possible result values for the request

public int countTargetValues () Number of result values

public boolean hasTargetValues () true , if there is at least one result value; false if not.

public IF Identifier getSourceIdentifier () Source label

public IFIdentifier getTargetIdentifier () Target label

public java.lang.String getSourceValue () Source value

Mapping Request

The package com.sap.aii.mapping.value.api provides the following classes:

XIVMFactory , to instantiate objects of type IFIdentifier and IFRequest

XIVMService , to execute the value mapping

Methods of Class XIVMFactory

Method Use

public XIVMFactory () Constructor

public static IFIdentifier newIdentifier Returns a label for the transferred values
( java.lang.String context, java.lang.String
agency, java.lang.String scheme)

public static IFRequest newRequest Returns a value mapping request for a source label, target label, and
( IFIdentifier sourceIdentifier, IFIdentifier source value
targetIdentifier, java.lang.String sourceValue)

Methods of the Interface XIVMService

Method Use

This is custom documentation. For more information, please visit the SAP Help Portal 8
2/21/2022
public XIVMService () Constructor

public static java.lang.String executeMapping Returns a result value


( IFIdentifier sourceIdentifier, IFIdentifier
targetIdentifier, java.lang.String sourceValue)
throws

ValueMappingException

public static IFResponse executeMapping Returns a value mapping result for a value mapping request
(IFRequest request)

throws ValueMappingException

public static IFResponse[] executeMapping Returns the value mapping results for several value mapping
(IFRequest[] requests) requests

throws ValueMappingException

public static java.lang.String executeMapping Returns the result value


( java.lang.String sourceContext,
If no result value exists, or an exception was thrown during
java.lang.String sourceAgency, java.lang.String
execution of the value mapping, the method returns the null value
sourceScheme, java.lang.String sourceValue,
java.lang.String targetContext, java.lang.String
targetAgency, java.lang.String targetScheme)

The exception ValueMappingException of the method executeMapping() is only thrown if an error occurs during the
execution of the value mapping or if the value cannot be mapped for other reasons.

Java Mapping of Adapter-Speci c Message Attributes

Use
There is a header for adapter-speci c message attributes in the message header of an XI message where sender adapters can
write additional information in the message header. In this way sender adapters can write information that only becomes known
at runtime into the message.

Developers can also get read and write access to adapter-speci c attributes in a Java mapping program.

Integration
There are mapping rutime contants for XSLT programs (J2EE) and message mappings that developers can use to access to the
same Java classes for mappings of adapter-speci c attributes as in Java mapping programs. Mapping programs that are
executed on the Integration Server supports this access.

There is a special interfaces for accessing ABAP Mappings (see interface documentation for interface
IF_MAPPING_DYNAMIC_CONF).

Features
The key for accessing the value of an adapter-speci c attribute is made up of a namespace and an attribute name that belongs
to the adapter. There are, for example, the following attributes for the le adapter:

Example Attributes of the File Adapter

Adapter Namespace Attribute Name Attribute Value

http://sap.com/xi/XI/System/File Directory C:\tmp\


This is custom documentation. For more information, please visit the SAP Help Portal 9
2/21/2022

http://sap.com/xi/XI/System/File FileName test-input.xml

The adapter namespace comprises the namespace in the Enterprise Services Repository in which the Adapter Metadata for the
adapter is saved and the name of the adapter metadata object. The adapter namespaces for the adapters shipped by SAP
therefore have the following format:

http://sap.com/xi/XI/System/ <Adapter Metadata Object Name of Adapter>

The adapter metadata objects are in namespace http://sap.com/xi/XI/System of software component SAP BASIS .

Mapping API

The classes for accessing the adapter-speci c attributes are part of the mapping API (package com.sap.aii.mapping.api ):

com.sap.aii.mapping.api.DynamicConfiguration Key

Class to create a key object for an adapter-specific attribute.


The key object consists of the adapter namenspace and the attribute name.

com.sap.aii.mapping.api.DynamicConfiguration

Class to read, change, or delete the value of an adapter-speci c attribute. You access the attributes in the methods using
objects of DynamicConfigurationKey .

For more information on the Mapping API, see SAP Developer Network as of SAP NetWeaver '04 SPS14 under
https://www.sdn.sap.com/irj/sdn/javadocs (SDN user required).

Adapter -Speci c Attributes and Multi-Mappings

The question remains for a Multi-Mapping about how to deal with a variety of message headers with adapter-speci c attributes.
Basically, the Mapping API can only access one message header. This has the following consequences, depending on whether
there are multiple source or target messages:

1:n transformation

If there are multiple target messages, the header for the adapter-speci c attributes is copied for each message. You
cannot create individual headers for the adapter-speci c attributes for each message, but one header for all.

n:1 transformation

This variant is only possible for multi-mappings in integration processes. If there is more than one source message, then it
is not possible to have read-only access to the adapter-speci c attributes of the different message headers at runtime.

m:n transformation

The restrictions mentioned above apply here. Here, developers can write the same adapter-speci c attributes for all
target messages to the header without having to have read-only access the source message. m:n transformations are
only supported in integrations processes.

JAVA Mapping API (SAP NetWeaver 2004 and 7.0)

Use
Although the JAVA mapping API has been revised (see: Java Mapping ) and SAP recommends that you use this new API for new
Java mapping programs, the JAVA mapping API for SAP NetWeaver 2004 and SAP NetWeaver 2004 and 7.0 remains a feature of
SAP NetWeaver. Consequently, all JAVA mapping programs that you implemented using the Java mapping API for SAP
NetWeaver 2004 or SAP NetWeaver 7.0 are still valid and do not need to be modi ed.

This is custom documentation. For more information, please visit the SAP Help Portal 10
2/21/2022

 Caution
The JAVA mapping API (SAP NetWeaver 2004 and 7.0) does not support parameterized Java mappings.

Furthermore, in user-de ned functions of message mapping programs, you continue to access the constants of the mapping
runtime by using the JAVA mapping API for SAP NetWeaver 2004/SAP SAP NetWeaver 7.0.

Prerequisites
Ensure that you read the implementation considerations and restrictions in Java Mapping . These also apply for the Java
mapping API for SAP NetWeaver 2004 / SAP NetWeaver 7.0.

Features
To program a Java mapping with the Java mapping API for SAP NetWeaver 2004/SAP SAP NetWeaver 7.0, you must de ne a
Java class that implements the Java interface com.sap.aii.mapping.api.StreamTransformation . This interface has two methods:

public void execute(java.io.InputStream in, java.io.OutputStream out)

The Process Integration runtime calls this method to execute a mapping. This method receives an input stream for the
source document and an output stream for the target document as parameters. These streams are usually XML
documents. You can parse the substructures to be converted from the input stream and output the converted target
document in the output stream.

public void setParameter(java.util.Map param)

The Process Integration runtime transfers parameters to the mapping program with this method. It evaluates these
parameters at runtime in the method execute() . This enables you to control the process ow of the mapping.

The transferred object that implements the Java interface java.util.Map contains seven key/value pairs as parameters.
These correspond to corresponding elds in the message header. Apart from the MAPPING_TRACE constant, the value objects
are of type java.lang.String . The key objects are de ned in the class
com.sap.aii.mapping.api.StreamTransformationConstants :

String Mapping Runtime Constants

Constant Meaning

MESSAGE_CLASS Classi cation of message. Possible values:

ApplicationMessage : Asynchronous or synchronous


request message

ApplicationResponse : Response to a request message

SystemAck , ApplicationAck , SystemError ,


ApplicationError : Acknowledgment Messages

VERSION_MAJOR XI message protocol version. Example: For the XI 3.0 message


protocol VERSION_MAJOR = 3 and VERSION_MINOR = 0.

VERSION_MINOR

PROCESSING_MODE The mode of a message can be synchronous or asynchronous.


Correspondingly, these constants can have the value
synchronous or asynchronous .

MESSAGE_ID The message ID. It can change during communication:

This is custom documentation. For more information, please visit the SAP Help Portal 11
2/21/2022
Response messages get a new message ID.

If new messages result from a message (the message is copied at


multiple receivers), the new messages get new message IDs.

REF_TO_MESSAGE_ID The ID of a referenced message that belongs semantically to this


message. For example, a response message uses this eld to note
which request message it belongs to.

CONVERSATION_ID This eld is not mandatory in the message. It enables an ID to be


used to group messages that belong together. This eld is not
intended to be used for message serialization and has nothing to do
with the serialization context ( ABAP proxy runtime, Java proxy
runtime).

TIME_SENT Time stamp specifying when the message was sent by the sender.
The format of the time stamp is as follows:

YYYY-MM-DDTHH:MM:SSZ

The letter 'T' separates the date from the time, which is generally
speci ed in UTC. If it is a local time, the closing 'Z' is omitted.

INTERFACE Sender interface name. As of SAP XI 3.0, use this constant instead
of the constant SENDER_NAME used previously.

INTERFACE_NAMESPACE Sender interface namespace.

As of SAP XI 3.0, use this constant instead of the constant


SENDER_NAMESPACE used previously.

SENDER_PARTY Communication party that sent the message.

SENDER_PARTY_AGENCY Issuing agency for the message sender.

SENDER_PARTY_SCHEME Identi cation scheme used by the sender.

SENDER_SERVICE Communication component on the sender side that sent the


message. For example, the name of a business system.

As of SAP XI 3.0, use this constant instead of the constant


SENDER_SYSTEM used previously.

RECEIVER_NAME Receiver interface name.

RECEIVER_NAMESPACE Receiver interface namespace.

RECEIVER_PARTY Communication party to receive the message.

RECEIVER_PARTY_AGENCY Issuing agency for the message receiver.

RECEIVER_PARTY_SCHEME Identi cation scheme used by the receiver.

RECEIVER_SERVICE Communication component on the receiver side that receives the


message. For example, the name of a business system.

As of SAP XI 3.0, use this constant instead of the constant


RECEIVER_SYSTEM used previously.

MAPPING_TRACE Returns an AbstractTrace object that you can use to write messages
in the monitoring.

Activities
1. Implement your Java mapping, for example in SAP NetWeaver Developer Studio (more information: Runtime Environment
(Java Mappings) ).

This is custom documentation. For more information, please visit the SAP Help Portal 12
2/21/2022
2. Import your Java libraries to the Enterprise Services Repository as an archive (see Imported Archives (XSLT/Java) ).

Example
The following example shows how the MAPPING_TRACE and RECEIVER_NAME parameters are set and evaluated in a Java
mapping program:

import java.io.InputStream; import java.io.OutputStream; import java.util.Map; import java.util.HashMap; import


com.sap.aii.mapping.api. AbstractTrace; import com.sap.aii.mapping.api.StreamTransformation; import
com.sap.aii.mapping.api.StreamTransformationConstants;

public class JavaMapping implements StreamTransformation {

private Map param = null; private AbstractTrace trace = null;

public void setParameter (Map param) { this.param = param; if (param == null) { this.param = new HashMap(); } }

public void execute(InputStream in, OutputStream out) {

try {

trace = (AbstractTrace)param.get( StreamTransformationConstants.MAPPING_TRACE ); trace.addInfo('...');

// ...

String receiverName = (String)param.get(

StreamTransformationConstants.RECEIVER_NAME);

// ...

More information: Special Access to Mapping Runtime Constants

Special Access to Mapping Runtime Constants

Use
In some mapping programs it may be necessary to access elds in the message header. For this purpose, the mapping runtime
saves the eld 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

This is custom documentation. For more information, please visit the SAP Help Portal 13
2/21/2022
The keys are derived from the eld names of the elds in the message header.

Access Using String Constants Instead of Keys (Standard Case)

To be able to read the elds 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 speci ed 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-de ned 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
This is custom documentation. For more information, please visit the SAP Help Portal 14
2/21/2022
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 elds 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 eld in the message header, is transferred to a user-de ned 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 eld 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.

 Note
Since the new mapping API works with get-methods, you can only access the message header in this way when you are using
the SAP NetWeaver 2004 and 7.0 JAVA mapping API.

This is custom documentation. For more information, please visit the SAP Help Portal 15

You might also like