In SAP Cloud Integration, Message Mapping plays a crucial role. While most of us are familiar with configuring the "Static Reference Type" within Message Mapping, it's important to note that there's also a powerful feature called "Dynamic Reference Type" available. This functionality often goes unnoticed but can significantly enhance mapping flexibility.
Rather than hardcoding message mappings or configurations, you can dynamically assign them at runtime using headers, properties, or variables. This approach enhances the adaptability, efficiency, and reusability of your integration flows.
What is Dynamic Reference Type?
In SAP Cloud Platform Integration (CPI), the Dynamic Reference Type enables the runtime assignment and execution of different message mapping artifacts within a single integration flow. This feature is especially valuable when mapping logic needs to adapt to runtime conditions such as headers, properties, or partner-specific configurations.
This feature enables:
Why it matters?
In today’s fast-paced digital landscape, mastering this capability can significantly elevate CPI solutions and provide integration designs with a competitive edge.
We will delve into this topic by implementing a basic example to illustrate the concept.
Example: Dynamic Mapping Selection Based on Country Code
Scenario: Dynamically call a different mapping at runtime based on the CountryCode in
the source message, using the same source XSD format.
Step 1: Create two Message Mapping artifacts
Mapping 1: For Country Code IN
Mapping 2: For Country Code US
Here, we will do the same one-to-one mapping for both the Message Mapping as shown:
Step 2: Create a main Integration Flow
Step 3:
The expression I have used for this example is "ref:MM_${header.CountryCode}_CountryData". I have called the CountryCode from the Message Header that is created in the previous Content Modifier.
Step 4: Invoke the Message Mapping dynamically at runtime by using the value stored in MapVar.
Test Cases:
Test Case 1: If the CountryCode = IN, the IFlow will call the IN mapping
Test Case 2: If the CountryCode = US, the IFlow will call the US mapping
We can use this capability if we want to reuse the same Integration Flow for multiple scenarios. This enables flexibility and modularity, especially in complex integrations where different partners or message types require different mappings.
Hope you find this article valuable and helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |