Skip to Content
Author's profile photo Former Member

Accessing Value Mapping defined in Directory using Java functions

For a general understanding of value mapping read

To define a value mapping in the integration directory, goto Tools –> Value Mapping


In the pop-up that’s displayed, enter the values, SourceAgency & SourceSchema (for the source Agency & Schema) and TargetAgency & TargetSchema (for the Target Agency & Schema).
Enter the value mapping, the source and the target values.
In this case, a simple mapping is created as shown.


This simply means that, for the given source agency and schema contains the value “1”, the target needs to contain the value “Mr.”

In the integration directory,
Create data types, messages types, outbound and inbound interfaces. These are pretty straightforward tasks, so the details about them are not provided here.

Data type:

ValueMappingSource, ValueMappingTarget

Message type:

ValueMappingSource, ValueMappingTarget

Outbound message interface:


Inbound Message interface:


We will create a message mapping called valuemappingTest.
Create a new function as:


Import the package*;

The java code for this function is as follows:

String context = ““;

String senderAgency = “SourceAgency”;

String senderScheme = “SourceScheme”;

String receiverAgency = “TargetAgency”;

String receiverScheme = “TargetScheme”;

IFIdentifier src = XIVMFactory.newIdentifier(context, senderAgency, senderScheme);

IFIdentifier dst = XIVMFactory.newIdentifier(context, receiverAgency , receiverScheme);

try {

String res = XIVMService.executeMapping(src, dst, Source);

return res;

} catch (ValueMappingException e) {

// message the following if not found:

return  (“no ValueMapping found for [“Source“]”);


For a complete list of java classes and methods available to access value mapping, read here  .


When source data contains a value thats not found the mapping, the code in the catch block is executed the result is shown below.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Sukamar,
      interesting way to define a default value or return an error message like yours.
      Author's profile photo Former Member
      Former Member
      Hi Sukumar

      If we want to raise a warning, that value could not be found, as in general my target field should not have string "Value not found [10]" I would rather prefer to send a blank value and raise an warning and continue the processing or exception if it is a key field and stop the processing.
      How could we add that in the Java Function.


      Author's profile photo Former Member
      Former Member
      Blog Post Author
      Hi Dheeraj,
      Here is good blog on how to throw smart exceptions in mapping. [original link is broken] [original link is broken]
      Another one you might want to look is Raising Exceptions in SAP XI Mapping

      Hope this helps...

      Author's profile photo Former Member
      Former Member
      Hi Natrajan,

      I have query, suppose I need get multiple values for the mapped value.

      For this case, i have used IFRequest, IFResponse.

      after getting the mapped values, i need to return this values to ResultList.

      Here, how can i add IFResponse type data to ResultList