This article explains the concept of value mappings in SAP XI using a simple example. SAP XI supports two options of value mapping within the Graphical Mapping Editor – FixValues and Value Mapping.
In the FixValues function (Conversions -> FixValues), key-value pairs are maintained within the Integration Repository. Simply, double-click to define the key-value pairs to map source keys to target values as shown.
In the Value Mapping function (Conversions -> Value mapping), you can maintain multiple key value pairs externally e.g. you could maintain them in the Integration Directory. These are picked up at the runtime.
Now, let us understand how to implement Value Mapping. Maintain a value mapping table in your Integration Directory. To do this, open your ID and go to Tools -> Value Mapping in the menu path. Display Value Mapping dialog will open up. Specify Agency and Scheme for source and target. These can be any arbitrary string values. Generally, Party or Business system/service names are preferred for agency while namespaces with some text identifier is preferred for scheme. See the image below.
Click on the Display button. Value mapping table will be displayed. Click on Change button to edit the value mapping table. Specify the source and target values. You can as well specify a Group Name for each value pair.
Groups can be useful if you are maintaining values for more than two systems. For example, the figure above shows a sample value mapping table. A customer 5000006001 in system BS_ER1 refers to customer AF001 in system BS_CR1 and also refers to customer T6001 in system BS_TR1 (not shown in figure). Thus these three values would have a common Group Name say CG1. Group names again are arbitrary string values. Save and activate your change list.
Now, go to Integration Repository and open the mapping program where you wish to use the above created value mapping. Use the standard function Conversions -> Value mapping to map the desired field from source to target.
Double click to define function properties. A sample is shown below.
Since we have maintained value mapping in Integration Directory, under Value Mapping Context specify http://sap.com/xi/XI. Under Agency and Scheme, specify the Agency and Scheme values used in the Integration Directory. If you have used party or Business system/service names as Agency in ID, you can simply choose SenderParty or SenderService for sender and ReceiverParty or ReceiverService for receiver. The dropdown box already has these values to choose from. These values get replaced with actual Party/Business system/service names at runtime.
When you locally test the mapping in the IR, you will not be able to see the actual result since values are picked from ID at runtime. Only when you execute the scenario, you will see the transformed values. The image above shows source and target XML that has been transformed via Value Mapping.