SAP Cloud Integration version 6.31.**/5.39.**, one of the capabilities of SAP Integration Suite, comes with enhancement support of executing re-usable Message Mapping artifacts in Integration Flow, dynamically.
Note: SAP Cloud Integration version 6.31.**/5.39.** software update is planned on end of September or beginning of October 2022 (these are forecasted timelines, and may change).
Message Mapping Dynamic Assignments
As a pre-requisite, you need to have the understanding of how to use re-usable Message Mapping artifact, more information at https://blogs.sap.com/2021/06/17/sap-cloud-integration-message-mapping-as-artifact/ .
Till now, for a re-usable Message Mapping artifacts, you could refer and select only one Message Mapping artifact in Integration Flow, and in case if you had scenarios where depending upon a use case condition, if you wanted to execute different re-usable Message Mappings within the same Integration Flow, it wasn’t possible. With the recent feature enhancement support, you can opt to choose a dynamic message mapping assignment and execution through the header, property or via partner directory expressions having the format ref:<message_mapping_id>.
Message Mapping artifact ID
As you have observed in the above section, you need to have the message mapping artifact id to be used in the dynamic usage expression. For this, for an existing Message Mapping artifact, you need to follow the below steps to get the artifact Id.
Select the View metadata menu in Actions column
Copy the Id
Assigning/Referencing in Integration Flow
Now you have the message mapping artifact ID, you can refer it in the integration flow as described in below steps. For this blog post/demo purpose, I have created a header with value ref:Sample_Message_Mapping_1.
In similar lines you can define a property as well.
Select the message mapping flow step. In the property section, Processing tab, you will now see the Reference Type dropdown as shown in screenshot below.
By default, Static is selected to support the static reference to message mapping. For dynamic assignment, you need to select the Reference Type as Dynamic and in the expression section, provide header/property expression as shown in the screenshot below
Now, for the partner directory support, you need to maintain the message mapping Id in the as value in the partner directory entry in the form of pd:<Partner ID>:<Parameter ID>. E.g. for given partner directory entry,
you need to provide the expression as pd:demo:id_map3, as shown below screenshot.
Deploy the message mapping artifact and then deploy the integration flow where dynamic assignment is done, trigger the integration flow message in runtime and the dynamically referenced message mapping gets executed.
Integration flow message mapping flow step now getting support for dynamic assignment and execution of re-usable message mapping artifacts, you can execute different message mappings according to your use cases within the same integration flow.