Contents Overview
XSLT MappingJSON / JSON Object / JSON ArraysXML / XML SchemaXML Attribute / XML ElementFilterRouterGroovyWrite Varibale MulticastGather and Join
XSLT Mapping: “Extensible Stylesheet Language Transformations” mapping refers to the process of using XSLT to transform and map data between different formats during integration scenarios.
XSLT is a language used to transform XML structure into various format.
XSLT mapping is a powerful tool in SAP CPI that enables you to manage complex data transformations and mapping in integration scenarios, easing seamless communication between different systems with varying data formats.
JSON: JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax.
JSON Object:
JSON object literals are surrounded by curly braces.JSON object literals contain Key/Value pairs.Keys and Values are separated by a colon.
JSON Arrays: JSON arrays values must be type string, number object, array, boolean or null.
XML: XML (Extensible Markup Language) is a way to store and exchange data between systems. It’s a file format that can be read by both humans and computers.
XML Schema: An XML schema describes the structure of an XML document.
XML Attributes: Attributes values must always be quoted. for a person’s gender, the <person> element can be written like this-
XML Element: An XML the element is everything from element’s start tag to the elements end tag.
Filter: Use filter to from an extract information from an incoming message, in other words you Filter out parts of the message that you don’t want and extract only the data that you want.
Router: We use router when you specify conditions based on which the messages are routed to receive an interface during runtime.
The router is a tool directs messages to different recipient’s based on specific conditions.
Groovy: Groovy is an object-oriented language which is based on java platform.
Import: The import statement can be used to import the functionality of other libraries. which can be used in your code. By default, groovy includes the following libraries in your code
import java.lang.*
import java.util.*
import java.iot.*
import java.net.*
import groovy. lang.*
import groovy.util.*
import java. math. BigInteger
import java. math. BigDecimal
// using a println statement to print output to the console.
Println(“Hello World!”);
*Identifiers: Identifiers are used to define variables, functions or other user defined variables, identifiers start with letter, dollar or an underscore. they cannot start with number.
// use semi-colon after statement.
def x = 5;
define the processData(Message, message)
It is a function that runs the code inside it when the system calls this script.
In processData (Message, message), the word Message and message have different purpose:
1) Message (with a capital M) is the type (or class) of the object. it tells the system what kind of working with.
2) message (with a lowercase m) is the name of the variable that holds the actual data or object passed into the function.
Example-
processData is the recipe functionMessage (this is a recipe for cake)message (the cake is named Chocolate cake)
Write Variable: Write variables to share data across different integration flows (deployed on the same tenant).
A “Write Variable” step is used to store a piece of data (like a timestamp, token, or configuration value) as a variable that can be accessed and reused across different parts of an integration flow or even in other integration flows within the same tenant.
Multicast: We can use the Multicast step to send copies of the same message to multiple routes. we can send copies to all routes at once using Parallel Multicast or in an order of your choice using Sequential Multicast. This allows you to perform multiple operations on the same message in a single integration process. Without Multicast, you needed multiple integration processes to perform this task.
Gather And Join: The Gather step merges messages from different routes (into a single message) with the option to define certain strategies how to combine the initial messages. The Join step is used in combination with the Gather step. It brings together the messages from different routes, but it does not affect the content of the messages.
Difference between Gather and Join: The Gather step merges messages from different routes into one, while the Join step combines messages from different routes without changing their content.
Example Gather:
Input:
Message 1: {“OrderID”: “123”, “Status”: “Shipped”}
Message 2: {“OrderID”: “123”, “DeliveryDate”: “2025-02-01”}
Output (After Gather):
{“OrderID”: “123”, “Status”: “Shipped”, “DeliveryDate”: “2025-02-01”}
Example Join:
Input:
Message 1: {“OrderID”: “123”, “Status”: “Shipped”}
Message 2: {“OrderID”: “123”, “DeliveryDate”: “2025-02-01”}
Output (After Join):
[ {“OrderID”: “123”, “Status”: “Shipped”}, {“OrderID”: “123”, “DeliveryDate”: “2025-02-01”}]
Contents OverviewXSLT MappingJSON / JSON Object / JSON ArraysXML / XML SchemaXML Attribute / XML ElementFilterRouterGroovyWrite Varibale MulticastGather and Join XSLT Mapping: “Extensible Stylesheet Language Transformations” mapping refers to the process of using XSLT to transform and map data between different formats during integration scenarios.XSLT is a language used to transform XML structure into various format.XSLT mapping is a powerful tool in SAP CPI that enables you to manage complex data transformations and mapping in integration scenarios, easing seamless communication between different systems with varying data formats.JSON: JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax.JSON Object:JSON object literals are surrounded by curly braces.JSON object literals contain Key/Value pairs.Keys and Values are separated by a colon.JSON Arrays: JSON arrays values must be type string, number object, array, boolean or null.XML: XML (Extensible Markup Language) is a way to store and exchange data between systems. It’s a file format that can be read by both humans and computers. XML Schema: An XML schema describes the structure of an XML document.XML Attributes: Attributes values must always be quoted. for a person’s gender, the <person> element can be written like this-XML Element: An XML the element is everything from element’s start tag to the elements end tag.Filter: Use filter to from an extract information from an incoming message, in other words you Filter out parts of the message that you don’t want and extract only the data that you want.Router: We use router when you specify conditions based on which the messages are routed to receive an interface during runtime.The router is a tool directs messages to different recipient’s based on specific conditions.Groovy: Groovy is an object-oriented language which is based on java platform.Import: The import statement can be used to import the functionality of other libraries. which can be used in your code. By default, groovy includes the following libraries in your codeimport java.lang.*import java.util.*import java.iot.*import java.net.*import groovy. lang.*import groovy.util.*import java. math. BigIntegerimport java. math. BigDecimal// using a println statement to print output to the console.Println(“Hello World!”);*Identifiers: Identifiers are used to define variables, functions or other user defined variables, identifiers start with letter, dollar or an underscore. they cannot start with number.// use semi-colon after statement.def x = 5;define the processData(Message, message)It is a function that runs the code inside it when the system calls this script.In processData (Message, message), the word Message and message have different purpose:1) Message (with a capital M) is the type (or class) of the object. it tells the system what kind of working with.2) message (with a lowercase m) is the name of the variable that holds the actual data or object passed into the function.Example-processData is the recipe functionMessage (this is a recipe for cake)message (the cake is named Chocolate cake)Write Variable: Write variables to share data across different integration flows (deployed on the same tenant).A “Write Variable” step is used to store a piece of data (like a timestamp, token, or configuration value) as a variable that can be accessed and reused across different parts of an integration flow or even in other integration flows within the same tenant.Multicast: We can use the Multicast step to send copies of the same message to multiple routes. we can send copies to all routes at once using Parallel Multicast or in an order of your choice using Sequential Multicast. This allows you to perform multiple operations on the same message in a single integration process. Without Multicast, you needed multiple integration processes to perform this task.Gather And Join: The Gather step merges messages from different routes (into a single message) with the option to define certain strategies how to combine the initial messages. The Join step is used in combination with the Gather step. It brings together the messages from different routes, but it does not affect the content of the messages.Difference between Gather and Join: The Gather step merges messages from different routes into one, while the Join step combines messages from different routes without changing their content. Example Gather:Input:Message 1: {“OrderID”: “123”, “Status”: “Shipped”}Message 2: {“OrderID”: “123”, “DeliveryDate”: “2025-02-01”}Output (After Gather):{“OrderID”: “123”, “Status”: “Shipped”, “DeliveryDate”: “2025-02-01”} Example Join:Input:Message 1: {“OrderID”: “123”, “Status”: “Shipped”}Message 2: {“OrderID”: “123”, “DeliveryDate”: “2025-02-01”}Output (After Join):[ {“OrderID”: “123”, “Status”: “Shipped”}, {“OrderID”: “123”, “DeliveryDate”: “2025-02-01”}] Read More Technology Blogs by Members articles
#SAP
#SAPTechnologyblog