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.



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.

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:

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

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

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

    Method

    Use

    public XIVMFactory ()

    Constructor

    public static IFIdentifier newIdentifier (java.lang.Stringcontext,java.lang.Stringagency,java.lang.Stringscheme)

    Returns a label for the transferred values

    public static IFRequest newRequest (IFIdentifiersourceIdentifier,IFIdentifiertargetIdentifier,java.lang.StringsourceValue)

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

    Method

    Use

    public XIVMService ()

    Constructor

    public static java.lang.String executeMapping (IFIdentifiersourceIdentifier,IFIdentifiertargetIdentifier,java.lang.StringsourceValue)throws

    ValueMappingException

    Returns a result value

    public static IFResponse executeMapping (IFRequestrequest)

    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.StringsourceContext,java.lang.StringsourceAgency,java.lang.StringsourceScheme,java.lang.StringsourceValue,java.lang.StringtargetContext,java.lang.StringtargetAgency,java.lang.StringtargetScheme)

    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.