SAP Cloud Platform Integration (SAP CPI) provides a message mapping feature. One of the center elements of any integration stage is to interpret the message format/schema/rules between various message groups.
It is the graphical mapping tool that does not involve any “significant” coding but does have the flexibility to use custom code functions.
- It is incorporated appropriately with the SAP CPI web application.
- You can develop a message mapping by interfacing source structure fields to target structure fields through intuitive select, click, and connect features.
- It can only be used to perform the XML to XML transformations.
Some of the other mapping options provided by SAP Cloud Platform Integration:
- XSLT
- JavaScript & Groovy scripting
Mapping is an important step between source and target messages; it will be great if message mapping is tried before the iFlow is deployed. We can use DOST Add-on™ to test mapping features in each environment as per best practices and using good data in your functional end-to-end testing.
Simulation is the functionality for testing the message mapping while at the same time structuring the Integration Flow data in SAP CPI. Let’s take a quick review of SAP CPI systems hands-On considering IDOC to File scenario for GL Posting.
Stage 1: Create an iFlow in a package as below.
Click on edit as below:

Click Add and from the dropdown menu select Integration Flow:

On popup provide Integration Flow name:

Stage 2: Configure the IDOC sender channel as below. Give the endpoint name, which is one of a kind.

Stage 3: Now include the message mapping in the iFlow and snap on the pointed symbol as below.

Provide mapping name and click on create:

Stage 4: Now import the XSD from the local folder as the input and output schema as below.



Map source and target structures with conditions or coordination.

Stage 5: To simulate or test, click on the Simulate option in the mapping as below and after that another window pops up. Presently click on the browse button and select the input file for testing.



Stage 6: Now click on the test option and check the output structure is creating. Once the file is uploaded, we can change the edited field data and test on various occasions if fundamental.
Confirm the mapping conditions are filling in as characterized below.


“COS” is concatenated to the Cost_Center field:

Stage 7: We can also perform the Display Queue option in mapping for analyzing node by node as below.
Click on highlighted button:

Popup window will appear now, which will show array of values:

Limitations:
1. Simulation is not possible without uploading the sample XML.
2. Can’t copy similar or the same mapping for one target element to another.
3. GUI is a little problematic, as you have to scroll to the right for complex mappings.
4. As compared to SAP PO, the display queue option takes more time to load.
XSLT Mappings:
We can also use XSLT mappings for achieving the XML-based mapping requirements in SAP CPI. We need to follow below steps to use XSLT mapping:
- Select XSLT mapping from pallet objects:

- Place it at the required position in iflow and click on the + icon:


- A new screen containing basic XSL template will appear; write your required XSLT transformations as below to concatenate cost center and GL account fields:

- After saving and deploying the above transformation, we are ready to test the mapping end to end.


- We can see before mapping and after mapping the payload in monitoring for the Iflow:
Before XSLT Mapping:

After XSLT Mapping:

Limitations:
1. We can test XSLT mapping by deploying iflow or by external tools. Without deploying testing is not possible, you can use tools like DOST Add-on to speed up the iflow transport, testing and error handling tasks.
2. It can be used only for input messages of type XML.
3. The editor has very limited functionality and does not provide many recommendations.
4. Writing of XSLT mapping required knowledge of XSL syntax and was not easy to use.
Groovy Script Mappings:
The third method of transformation available in CPI is groovy/java script mappings. We can use Groovy mappings by following the steps below; it gives you Superman powers to transform and include custom logic in your interfaces:
- Select a groovy script from the pallet object and place it at appropriate location in iflow where mapping transformation is required:

Click on the + icon after placing:

- After New screen appears, you can write your required groovy script transformation on the provided screen:

- After saving and deploying the above transformation, we are ready to test the mapping end to end.


- We can see before mapping and after mapping the payload in monitoring by enabling log level as trace for the Iflow:
Before Groovy Script:

After Groovy Script:

Limitations:
1. We can test groovy script mapping by deploying iFlow or by external tools. Without deploying, testing is not possible.
Conclusion:
The message mapping (graphical) tool is exceedingly simple to get and begin with; you can learn the basics in a very short amount of time. It excels at solving mapping problems of low to medium complexity. Graphical, Groovy, XSLT individually or a combination of one or many types of message mapping “together” can solve different categories of problems. We can use Groovy or XSLT mappings. If detailed custom logic/transformation is required between source and target messages.
By utilizing the Simulate choice, you can try to test the mapping changes, but you must have the XML beforehand. The same applies for Groovy or XSLT mappings, where SAP CPI gives very limited options to test the mappings individually. DOST Add-on™ solves this problem beautifully, where you can test your iFlows at the component or system level with fast & easy transport of iFlows and test your Groovy, XSLT, and graphical mappings with the next level of simplicity in each environment as per the change management best practices. Contact us to learn more about our innovative, problem-solving approach to supercharge your SAP CPI productivity and user experience.
ABUSINESS is active in the field of systems integration, focusing on SAP, SAP Cloud Platform, S/4HANA, and C/4HANA technologies with subject matter expertise in SAP Cloud Platform, CPI, PI, PO, Dell Boomi, MuleSoft, etc. platforms. A core part of our services consists of providing help with a strategic analysis of your integration strategy and reviewing your current development roadmap. Contact us today for consultations at info@abusinesstech.com.
Related articles:
- The Role of an SAP Consultant in Modern Business
- The Hidden Gems of SAP Architect
- SAP DevOps: Empowering Modern Business with Abusiness Tech
- What is an SAP Developer?
Do you want to
learn more about integration?
We are dedicated to make our knowledge accessible. You can either figure it out by yourself or you can let us give you a hand.
Let us take care of your integration.
We are SAP Certified and we can make your project happen. Explore our services and contact us. We will be happy to take on your project.
View Our Services
-modified.png)

