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

SAP Cloud Integration – Multi Mapping in Message Mapping

Introduction

SAP Cloud Integration version 2.40 improves message mapping with multi mapping feature. Multi mapping enables you to use more than one message in the source or target of your mapping.

Let us understand multi mapping further with a simple integration flow.

Clicking on the resource link (MultiMappingDemo.mmap in this case) opens the message mapping editor

It already has one message in the source and target message structures.

Click on the pen icon to Edit message for source and/or target

 

This opens up the source and target messages editor. If you have already worked with it, you might observe the below changes

  1. Add icon ‘+’ has been introduced, to add more messages
  2. Occurrence table column has been introduced, to change the occurrence of message
  3. Action column has been introduced with
    1. Icon to Replace the message
    2. Icon to Delete the message

 

Occurrence

You can use the occurrence column to change the occurrence of the message. By default, the occurrence ‘1..1’ shall be selected. If you select the occurrence ‘0..1’ or ‘1..n’, the multi mapping for this message shall be enabled. For example, set the message occurrence to “0..1” click on OK header action. Go back to message mapping editor.

 

 

You will now observe the root element of the message is enclosed with ns0:Messages and ns0:Message1 elements as shown in the below screenshots. This indicates multi mapping.

 

The similar structure could also be observed in the target side as well.

 

Multiple Messages

Multi mapping is also enabled when you select more than one messages as the source or target in your mapping. Consider the same example of source and target message editor. Click on ‘+’ icon at Source Message and select a schema file.

 

Once the schema is added, you observe the same in source messages list shown below

 

 

Now, click OK. It will take you to the message mapping editor.

 

You can observe that elements for multi mapping has been populated in the source message with ns0:Messages root element and ns0:Message1 for existing EmployeeDetails element along with ns0:Message2 for newly added schema’s Levels element

Now, you can perform the required mapping definition for the multi mapping elements as per your scenario.

Note: Multi mapping support for EDMX is not enabled.

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh

      Hi Deepak

       

      Thanks for sharing this update. This functionality was one of the few gaps that made us still needing to develop some integration in Eclipse. Glad to know this is now available.

       

      One question on the multimapping feature - when using a 1-N mapping, the mapping requires the source to have the Messages & Message1 elements. In PI, this is automatically handled during runtime, e.g. the actual payload do not need to have those elements. However in CPI, this doesn't seem to be automatically handled, and we have to add a script before the multimapping step to wrap the payload with those elements. Any idea if this could be enhanced to handle it automatically?

       

      Regards

      Eng Swee

      Author's profile photo Danping Zhao
      Danping Zhao

      hello, i meet the same issue (Messages & Message1 can not handled in CPI)when use multi mapping, could you please give some details about how to handled this using script? Thank you

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

      Hi Eng Swee,

      Thanks for the feedback.

      Yes, Currently CPI doesn't handle it automatically, you need to handle it via script step. We will consider this in next upcoming releases.

       

      Regards,

      Deepak

      Author's profile photo Kalpana C
      Kalpana C

      Hi,

      We are having a doubt in multi mapping in HCI scenario like, in source side we have two structure(ns0:Message1 and ns0:Message2) and target side ns0:Message1 structure. Now we have to map ns0:Message1 source field to ns0:Message1 target field and ns0:Message2 source field to ns0:Message1 target field. Here we can able to pass only ns0:Message1 fields, we are not able to pass ns0:Message2 fields for mapping to the target structure message. While doing the simulation we are getting error.

      Here attached the mapping and error screen shots for your reference, Please provide the solution,

      Early response is valuable.

      Thanks.

       

      Author's profile photo Ravindranath Murali Babu
      Ravindranath Murali Babu

      We are also facing the same issue and the same error message.

      Hi Kalpana / All,

      If anybody know the solution for this above issue,could you please share the solution here.

      Error Msssage: Cannot produce target element /ns0:Messages/ns0:Message1/SendRequest. Queue has not enougth values in context. Target xsd requires a value for this element, but target field mapping does not produce one. Probably the xml-instance is not valid to the source xsd, or the target field mapping does not fulfill the requirement of the target xsd.

      Thanks

      Ravi

      Author's profile photo Ravindranath Murali Babu
      Ravindranath Murali Babu

      Issue Resolved:  Namespace Issue:  Added the namespace,issue resolved.

      <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

      Multi-Mappings https://help.sap.com/saphelp_nw73ehp1/helpdata/en/4b/f41847eaca4c86e10000000a42189e/frameset.htm

      Author's profile photo Naresh Dasika
      Naresh Dasika

      Can you clarify where exactly you have added this namespace to resolve the Issue?

      Author's profile photo Philippe Addor
      Philippe Addor

      As you can see, it's the namespace of the <Messages> element. This is the root of the source and target Messages structures.

      Author's profile photo Shruti Jain
      Shruti Jain

      Save your first payload in Payload1 using content modifier - exchange property (considering your second payload is in memory in.body)

      Then, add a content modifier before the message mapping and merge the 2 payloads in single input as shown below:

      <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
      <ns0:Message1>
      ${property.Payload1}
      </ns0:Message1>
      <ns0:Message2>
      ${in.body}
      </ns0:Message2>
      </ns0:Messages>

       

      Author's profile photo Vaishali Rani
      Vaishali Rani

      Hi All,

      I am trying to create multimapping, but I get the error as target element cannot be created. Though I have used required namespace. My source is an edmx file, can that be a reason for this. What is the other way to solve the issue in case of edmx file where I have multiple target structures.

      Thanks,

      Vaishali