Introduction
A more flexible and"dynamic"way to define a value mapping is to use the standard functionValue mapping (Conversions function group area). Using this standard function, you can refer to value pairs that are defined at a later point in time during configuration. To define the value pairs in eclipse we use value mapping group.
The advantages of this approach are that value mappings can be reused within different message mappings and values can be specified later at configuration time.We usevalue mapping to map multiple representations of an object across different applications or companies.There is a slight difference in defining Value mapping definition in SAP HCI and SAP PI [on-Premise].
Go to Eclipse main menu File --> New --> Integration project
In the new project Wizard, provide name for value mapping and select project type as “Value mapping” and click on Finish.
Value mapping project will be created in the “Project Explorer” with a node type “IFLMAP” as below.
Expand the project to check the default objects created under this
Modify the value mapping
Open value_mappig.xml under value mapping project.
Value mapping.xml --> Right click --> Paste the required xml as per the requirement.
We will get the below pop-up window to overwrite --> click Yes.
Continue
Click ok.
Open Value_mapping.xml in the editor and choose source tab
Enter the group ID, agency, schema and value as shown in the example below, and save the changes.
If we need to edit values, we can do it in design tab
How to use Value mapping in message mapping?
In the project explorer view à expand the project. Click on “src.main.resources.mapping”à double click the message mapping where you want to use the value
mapping.
Message mapping will be open in mapping editor.
Click on Definition tab to view the mapping between source and target structures.
In the expression tab page --> select the value mapping which is under standard functions --> Conversions
Select value mapping and drop it in expression editor tab.
Double click on the value mapping function and provide details for value mapping parameters.
Connect the node to the value mapping function as per the requirement and save the changes.
We can check the consistency to validate the value mapping. The inconsistencies can be invalid content [ values for agency – schema pair repeated / incorrect / missing tags] entered in the value_mapping.xml ma There may be chances to check To check the consistency of the value mapping.
Right click on the value mapping project and choose execute checks. We can check the results in console tab as shown below