Skip to Content
Product Information
Author's profile photo Deepak G Deshpande

SAP Integration Suite – Dynamically assign and execute Message Mapping Artifacts in Integration Flow

Introduction

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.

Summary

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.

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Yatanveer Singh
      Yatanveer Singh

      Great to see this dynamic mapping is finally introduced in CPI. Does CPI plan to have this in XSLT as well ?

      Author's profile photo Deepak G Deshpande
      Deepak G Deshpande
      Blog Post Author

      Hi Yatanveer,

      Thanks for the feedback. With respect to XSLT mapping,

      1. If you are looking for assignment of XSLT mapping dynamically, it is possible even today, as per the documentation https://help.sap.com/docs/CLOUD_INTEGRATION/368c481cd6954bdfa5d0435479fd4eaf/5ce1f15f54244d4aa557e9c79d93a684.html
      2. If you are looking for XSLT mapping as re-usable artifact in CPI, then it is not yet planned.

       

      Thanks

      Deepak

      Author's profile photo Yatanveer Singh
      Yatanveer Singh

      Hi Deepak,

      What do you mean by "assignment of XSLT mapping dynamically"

      If the requirement is: pick one of the 2 XSLT files based on input value in input payload, is it possible today?

       

      Reagrds,

      Yatan

      Author's profile photo Deepak G Deshpande
      Deepak G Deshpande
      Blog Post Author

      Hi Yatanveer,

      Yes, achieved through the way you model your scenario. Assume that you have a header declared in your integration scenario, based on the input payload you use a router step/script etc. and you assign the value of the header with value either xslt1 or xslt2 (all these before the xslt flow step sequence in the integration flow editor), the the assigned xslt mapping (in the header) will get executed.

      Its more towards how you model your integration

      Thanks

      Deepak

      Author's profile photo Daniel Graversen
      Daniel Graversen

      Cool. It would also be cool to have the feature from the Groovy script. I can see it gives some more complexity because you both need to select Script collection, Correct Script, and Method to run.