0% found this document useful (0 votes)
309 views40 pages

Value Mapping Interview Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
309 views40 pages

Value Mapping Interview Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 40

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

When do you use value Mapping :

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

What are different ways to use value Mappings:

 Graphical Mapping
 Import from CSV file
 Using API

Examples of value Mapping Sceanrios:

 Business Partner Translations: translating different business partners


 Country Code Mapping-converting country codes to country names
 Currency Code Mapping-Converting currency codes to currency names.
Difference between Field Value Mapping vs Value Mapping

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

For that we are

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

In your package, in Edit mode, add "Value Mapping".


Below is the output we are looking for:

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 BLUE are the "Agency".

 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.

 The C column has the value to be mapped for the Receiver.

It is a must to save the file in:

1) CSV format i.e. Comma delimited and


2. The encoding has to be "Unicode (UTF-8), as shown in the screenshot below:
THAT"S IT!

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.

Deploy your Iflow and enjoy!


CREATING SAP CPI 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.

Step 4 : Click on edit


Step 5 : Click on Add.

Step 6 : Fill the required details and Conversion Values.

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 9 : Go to Design Window and Create an Integration Flow under Artifacts.

Step 10 : Open the Integration Flow in edit Mode. Add a Message Mapping and a Content
Modifier.

Choose Sender Adapter as SOAP.


Step 11 : Select SOAP Adapter. Under Connection tab, Give a relative address to define the
Endpoint. (/Mapping)

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 14 : Click on Add Source Message.

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.

<?xml version="1.0" encoding="UTF-8"?>


<wsdl:definitions name="SendOrder_Async"
targetNamespace="http://cpi.sap.com/demo"
xmlns:p1="http://cpi.sap.com/demo"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-
wssecurity-utility-1.0.xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation />
<wsp:UsingPolicy wsdl:required="true" />
<wsp:Policy wsu:Id="OP_SendOrder_Async" />
<wsdl:types>
<xsd:schema targetNamespace="http://cpi.sap.com/demo"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://cpi.sap.com/demo">
<xsd:element name="Order_MT" type="Order_DT" />
<xsd:complexType name="Order_DT">
<xsd:sequence>
<xsd:element name="orderNumber"
type="xsd:string" />
<xsd:element name="Environment"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Order_MT">
<wsdl:documentation />
<wsdl:part name="Order_MT" element="p1:Order_MT" />
</wsdl:message>
<wsdl:portType name="SendOrder_Async">
<wsdl:documentation />
<wsdl:operation name="SendOrder_Async">
<wsdl:documentation />
<wsp:Policy>
<wsp:PolicyReference URI="#OP_SendOrder_Async" />
</wsp:Policy>
<wsdl:input message="p1:Order_MT" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SendOrder_AsyncBinding" type="p1:SendOrder_Async">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
<wsdl:operation name="SendOrder_Async">
<soap:operation
soapAction="http://sap.com/xi/WebService/soap1.1"

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>

Click on Upload from the file system.

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.

<?xml version="1.0" encoding="UTF-8"?>


<wsdl:definitions name="SendOrder_Async"
targetNamespace="http://cpi.sap.com/demo"
xmlns:p2="http://cpi.sap.com/demo"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-
wssecurity-utility-1.0.xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation />
<wsp:UsingPolicy wsdl:required="true" />
<wsp:Policy wsu:Id="OP_SendOrder_Async" />
<wsdl:types>
<xsd:schema targetNamespace="http://cpi.sap.com/demo"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://cpi.sap.com/demo">
<xsd:element name="Order_MT" type="Order_DT" />
<xsd:complexType name="Order_DT">
<xsd:sequence>
<xsd:element name="orderNumber"
type="xsd:string" />
<xsd:element name="Environment"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="Order_MT">
<wsdl:documentation />
<wsdl:part name="Order_MT" element="p2:Order_MT" />
</wsdl:message>
<wsdl:portType name="SendOrder_Async">
<wsdl:documentation />
<wsdl:operation name="SendOrder_Async">
<wsdl:documentation />
<wsp:Policy>
<wsp:PolicyReference URI="#OP_SendOrder_Async" />
</wsp:Policy>
<wsdl:input message="p2:Order_MT" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SendOrder_AsyncBinding" type="p2:SendOrder_Async">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" />
<wsdl:operation name="SendOrder_Async">
<soap:operation
soapAction="http://sap.com/xi/WebService/soap1.1"

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 Key It will pass the incoming value as it is.

Use Default Value It will pass the Default Value that is specified in the Default Value field.

Throw Exception This will throw an exception.

I have used Use Key.

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 25 : Select the Content Modifier. Under Message Body tab,


choose Type=Expression and Body : ${in.body} to capture the incoming payload.
Step 26 : Save and Deploy.

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

Step 28 : Open POSTMAN . Create a new request with type POST.

Paste the Endpoint copied in previous step in URL tab.

Type : Basic Auth

Username : Client ID

Password : Client Secret

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.

2. Try adding different functions available in Mapping window to transform source to


target and test the same.
SAP CPI Message Mapping Tutorial

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.

The Prerequisites: What You Need Before Importing


Make sure you have the necessary resources before you start the import value mapping process. It is
critical to have access to SAP Cloud Integration and to have a thorough understanding of your
integration scenario. Become familiar with the precise mappings and values required by your system to
ensure a seamless import process.

Step-by-Step Guide: Importing Value Mapping in SAP Cloud Integration

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.

Tips for Optimal Value Mapping

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.

Define Value Mapping in SAP CPI:


In SAP CPI, you can define value mappings in the Integration Directory.
Go to the Design tab in the SAP CPI Cockpit and select the Integration Directory.
Create a new Value Mapping or select an existing one.

Create Value Mapping Entries:


Once you have a value mapping, you need to define the actual mappings between source and target
values.
For each value mapping, you can create entries that specify the source and target values along with any
necessary details or transformations.

Use Value Mapping in Message Mapping:


When designing your integration flow, you can use the value mapping in the message mapping step.
In the message mapping, you can reference the value mapping to perform value conversions.

Configuring Value Mapping in Integration Flow:


Within the Integration Flow, you'll configure the value mapping to be used.
This typically involves specifying the source and target contexts and associating the value mapping you
created.

Testing and Monitoring:


It's important to test your integration flow thoroughly to ensure that the value mappings are working as
expected.
The SAP CPI monitoring features allow you to track and analyze the execution of your integration flows,
including the value mapping steps.

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:

Source: "US" -> Target: "United States"


Source: "CA" -> Target: "Canada"
Source: "DE" -> Target: "Germany"
Then, in your integration flow, when mapping data, you reference this value mapping to convert country
codes to country names.

Difference between Fix values vs Value Mapping

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.

You might also like