Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member


For a general understanding of value mapping read
here


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:

ValueMappingSource




Inbound Message interface:

ValueMappingTarget




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


Import the package com.sap.aii.mapping.value.api.*;



The java code for this function is as follows:


String context = "http://sap.com/xi/XI";

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.

</br>

4 Comments