Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Any integration's most important part is always the mappings and most of the data we find in integration industry will be XML. Day to day we deal with XML and manipulation of XML. And what better tool to do that other than XSLT.

In the blog post we look at XSLT mapping to create custom batch request for Odata services.

We can create XSLT mapping or groovy scripts to create custom batch request when we are updating multiple entity in single batch request as CPI will not generate the XSD for multiple operation on multiple entities of the same OData API.

Things we can accessing the below XSLT code:

  1. Access the exchange property of message.

  2. Creating  local variables to be used for creating the batch request.

  3. XSLT for each to for looping.


We can even access headers and set properties, headers from XSLT.


Sample XSL to Generate the XML for Batch processing
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
<!--The Parameter values will be fetched from exchange properties of the
Message -->
<xsl:param name="para1" />
<xsl:param name="para2" />
<!--Starting of the batch -->
<xsl:for-each select="root/row/sub-row">
<!--Creating variable which will be used in many batch parts -->
<xsl:variable name="var1">
<xsl:value-of select="@attribute" />
<xsl:for-each select="Subelemet/S-child">
<!--entity set name and entity set -->
<!--Map all source fields to target fields -->
<xsl:value-of select="$var1" />
<xsl:value-of select="$para2" />
<xsl:value-of select="@attribute1" />
<!--You can add new entity set here of the same ODataAPI -->


When we have a need for customizing the batch request and need to perform operations on multiple entities. We can use the above generic XSLT mapping skeleton to create needed XSLT code.

This code can be starting point for creating the XSLT mapping for batch requests.

Please refer to link to read more about XSLT 3.0.