Value Mapping Interview Questions
Value Mapping Interview Questions
Value Mapping in sap cpi is a method used to maintain a relationship between different values
representing the same data objects across various systems ..technically it acts as a birectional lookup
table allowing for consistent data transformation during integration process
Value Mapping is used when there is a need for data consistency and integrity across different systems it
is particulary useful in scenarios where data needs to be adapted to specific business rules or when
dealing with large data sets
Graphical Mapping
Import from CSV file
Using API
Fixed Value Mapping: Fixed Value is very useful when you have lots of conditions coming in one source
field during mapping, then to avoid the IfThenElse or UDF we go for Fixed Value mapping.
Example: if your source field contains 01 or 02 or 03 or.....12 and you want the result as JAN or FEB or
MAR or ......... DEC.
Advantage: Using fixed value table you can see the result immediately in the mapping.
Disadvantage: If you have used the same fixed value mapping at several places in you mapping then in
case of any change in fixed values you have to make the changes at several places. So in short fixed
value mapping is not good from the maintenance point of view.
Value Mapping: Value Mapping also works in the same way as fixed value mapping, only the thing is you
will get the result at run time only. And you have to define the value mapping in Integration directory.
Advantage: If you have used the same value mapping at several places in you mapping then in case of
any changes in values you don't have to make the changes in you mapping, just make the changes in in
value mapping in Integration Directory, that's it.
Disadvantage: you can't the see the result immediately in mapping. Results can be seen only at run time.
Difference between value mapping and fixed values –purpose is same Instead of source value if you
want to send another value
Suppose in source the Country code has INDIA but in the target we need to have Country code as IN
Conversions ->ValueMapping
If you use USE key ..if you get any other value apart from what you provided in Advance what ever
value you are receiving from source will be sent to target
Default value :
Value Mapping:
Fixed values - specific to this iflow ..limited values .. we are using values at mapping level ..
Value Mapping : can be used Across the iflows ..Value Mapping table we are maintaining
outside of mapping..if there are n number of values ..
In Value Mapping table if values are frequently changing and its used across 10 iflows ..it will replicate
automatically..you don’t need to change in every iflow
To upload data into the Bidirectional Mapping, you need to prepare a .csv file as shown below. Things
to keep in mind:
The words in PINK are the Identifier, which may or may not be same.
The numbering in GREEN in column A is a unique numbering for the rows which can alphabets
or numbers or alphanumeric.
The B column contains the values coming in from the Sender which is to be concatenated with
a Pipe i.e. | , which is a must.
After your file is ready, in CPI, in your Value Mapping artifact, click on IMPORT, then SAVE/ SAVE AS
VERSION (I always save as version), and then, DEPLOY.
After your artifact is deployed, go to the Message Mapping of your IFlow, select the function
"valueMapping" in the Mapping Expression, and type the Source Agency, Source Identifier, target
Agency, and Target Identifier as maintained in your Value Mapping.
Step 1 : Go to Artifacts tab of your Package. Add –> Value Mapping, This will add sap cpi
value mapping.
Step 2 : Select Create Radio Button and Give a valid Name. (This step is sap cpi
namespace )
Step 3 : Click on the new Value Mapping Created.
Source Target
A 1
B 2
C 3
Step 7 : Save and Deploy.
Step 8 : In Overview Window, Make sure that the Value Mapping is started.
CREATING INTEGRATION FLOW
Step 10 : Open the Integration Flow in edit Mode. Add a Message Mapping and a Content
Modifier.
Step 12 : Select Message Mapping and Click on Create button highlighted below.
Step 13 : Give any Valid name for your Mapping. Click on Create.
Step 15 : Click on Upload from File System. Browse and select the Source WSDL.
Copy the below sample WSDL for Source message and save to upload.
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
<wsdl:input>
<soap:body use="literal"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
Step 16 : Repeat the Step 14 and Step 15 for Target message and choose target WSDL.
Copy the below sample WSDL for Target message and save to upload.
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
<wsdl:input>
<soap:body use="literal"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
Step 17 : It will look as below.
Step 18 : Click on Source Element and drag to the target element to map respective fields.
Now it will look as below.
Step 19 : Click on fx Symbol to edit the mapping for that element.
Step 20 : From the left window, choose Conversions –> Value Mapping
Step 21 : Place the Value Mapping block in center and Connect Source to
input , valueMapping to Target as shown in the below picture.
Step 22 : Click on Advanced and fill the required details same as the deployed Value
Mapping in Step 7 .
On Failure :
On Failure Expected Outcomes when the incoming Message has any other value apart from the once m
Use Default Value It will pass the Default Value that is specified in the Default Value field.
Step 23 : Click on OK at top right corner. It will redirect you to the Main Integration Flow.
Step 24 : You can edit your mapping any time from Processing tab of Message Mapping.
Step 27 : In overview window, make sure that your flow is in Started state. Click on Copy
button highlighted under Endpoints tab to Copy the Endpoint.
TESTING THE ARTIFACTS
Username : Client ID
Client Id and Client Secret you will get when you create Process Integration Runtime
Instance during tenant setup. ( Refer Step 34 of this post )
Step 29 : Under Body tab, Choose Raw radio button and XML message Type. Type the
below input message. Click on Send.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:demo="http://cpi.sap.com/demo">
<soapenv:Header/>
<soapenv:Body>
<demo:Order_MT>
<orderNumber>A</orderNumber>
<Environment>CS</Environment>
</demo:Order_MT>
</soapenv:Body>
</soapenv:Envelope>
Step 30 : You will get back the result as below. Note that the OrderNumber is changed
from A to 1 in output. This is due to the use of Value Mapping.
Step 31 : Change orderNumber to B and C and click on Send. You should get the response
as 2 and 3 respectively.
Step 32 : Change the orderNumber to any random value. Say 45. Click on Send. You will
get back the same value 45. This is because we have used “Use Key” in On Failure field
at Step 22.
SELF- TRY :
1. Try Changing the On Failure value in Step 22 to “Use Default Value” and “Throw
Exception”. Deploy the flow. Test with different input values.
The below is a detailed example with SAP CPI message mapping using if conditions, and
how to do namespace mapping. If you are good to go with Message mapping in CPI let’s
look into a bit advanced version which is importing value mapping to SAP CPI.
1. Open the Excel sheet and create the Table using the Delimiter, Source, and Target values.
3. Here the each colour represent the different elements of the Value Mapping.
4. Save the excel sheet as the .csv file. While saving the file, Go to Tools option.
5. Under the Encoding tab, select the Unicode (UTF-8), and save the file.
6. Open the Integration Package in the Cloud Integration and create the new Value Mapping File.
7. Click on Import in newly created value mapping.
8. Select the csv file and upload the file.
9. The file will upload as shown below.
1. The Secret Is Consistency: To prevent misunderstandings and mapping mistakes, keep the
naming convention for values consistent across systems.
2. Frequent Updates: Review and update your value mappings to appropriately reflect changes as
your integration landscape changes.
3. Testing is Essential: Perform extensive testing in a sandbox to find and fix any potential
problems before implementing value mappings in a live environment.
Error Handling:
Implement error handling mechanisms in your integration flow to manage issues related to value
mappings.
This can include logging, alerting, and reprocessing strategies.
Example:
Let's say you have a scenario where a source system sends a country code, and you need to map it to
the corresponding country name. You would define a value mapping with entries like:
Fix Values:When you have finite set of values which are kind of static or not going to be changed over
then you will use fix value mapping.You are going to hard code these values inside message mapping
and in case of any changes you need to modify iflow and deployment required. This usually triggers
regression testing from change management perspective.This requires technical resources to be
available for any modification to values. Ex : Gender can be stored in fix value mapping.
Value Mapping: When you have large/small set of values which are going to be changed (addition or
modification To existing values) over period of time then you will use value mapping.No need to change
iflow and during runtime these values rendered from value mapping project.Any change request for
addition or modification of values can be done by non technical guy also since it has separate UI which
very simpler to use. EX:PayComponent types or disability type codes.