Powered By

Free XML Skins for Blogger

Powered by Blogger

Friday, January 16, 2009

SAP XI Executing Value Mappings

Use

At configuration 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

It is possible for an object (for example, a material number) to be identified differently at the receiver than at the sender (see: Value Mapping Table); 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 identification scheme (for example, a company)

· The identification scheme used (for example, the scheme “customer number”)

· The value of the object, which is dependent on the identification 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.

This graphic is explained in the accompanying text

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 IFIdentifier

Method

Return Value for Label

public java.lang.String
getContext();

Value mapping context

public java.lang.String
getAgency();

Agency

public java.lang.String
getScheme();

Identification scheme

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 first 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 IFIdentifier
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(
java.lang.String context,
java.lang.String agency,
java.lang.String scheme)

Returns a label for the transferred values

public static IFRequest newRequest(
IFIdentifier sourceIdentifier,
IFIdentifier targetIdentifier,
java.lang.String sourceValue)

Returns a value mapping request for a source label, target label, and source value

Methods of the Interface XIVMService

Method

Use

public XIVMService()

Constructor

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

ValueMappingException

Returns a result value

public static IFResponse executeMapping(IFRequest request)

throws ValueMappingException 

Returns a value mapping result for a value mapping request

public static IFResponse[] executeMapping(IFRequest[] requests)

throws ValueMappingException

Returns the value mapping results for several value mapping requests

public static java.lang.String executeMapping(
java.lang.String sourceContext,
java.lang.String sourceAgency,
java.lang.String sourceScheme,
java.lang.String sourceValue,
java.lang.String targetContext,
java.lang.String targetAgency,
java.lang.String targetScheme)

Returns the result value

If no result value exists, or an exception was thrown during execution of the value mapping, the method returns the null value

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.

No comments:

Archives