Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member181985
Active Contributor

1/20/2015: Updated with an example multi-map Payload

Multi-mapping dynamic configuration has been a frequent requirement and there are many open questions in SAP PI space, since multi-mapping doesn't support dynamic configuration i.e., a separate dynamic configuration for each child message. Some time back I wrote a blog Multi-mapping: Assigning ASMA's for Child Messages using Custom Adapter Module and FM but unfortunately that solution can't be used for PI/PO single java stack systems

In this blog, I would like to share my new solution using a simple generic custom adapter module. The module can be used for any J2EE technical adapter by just configuring it in the respective communication channel. The module is applicable for all pi versions except few changes to import statements and few methods due to changes in module API. Highlighted the required changes as a comment in the attached module source code


Steps



  • Enhance each target message structure i.e., data type/external definition to have custom dynamic configuration header which will reflect in multi-mapping program as shown in the below snap shot. We enhance target structure mainly due to two reasons i. to utilize in the custom module to set dynamic headers for each child message ii. to easily remove the enhanced structure via module configuration and of course after step i

  • Now you can map required dynamic header values (DC technical name, DC namespace and it's value) either from source structure (or) via some lookup (or) some complex calculation using UDF based on your requirement. Please note that, DCRecord node occurrence is unbounded in nature and hence you can duplicate this structure how many ever times you want to utilize it for other DC technical attributes
  • The attached custom module expects two xpath parameters as input,
    1. DCXPATH - to evaluate dynamic headers from the child payload e.g., for the above defined structure it will be /MT_Receiver/DCHeader/DCRecord
    2. DCXPATHDEL - to delete the enhanced structure which is obviously not required by target system e.g., for the above defined structure it will be /MT_Receiver/DCHeader
  •     Deploy the custom module and use it in the required channel with the above mentioned parameters


Transformed Example Multi-Map Payload from Mapping:-


<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
  <ns1:MT_Receiver xmlns:ns1="http://pg.com/multimap">
  <!-- ENHANCED DCHeader STRUCTURE for Dynamic Configuration -->
  <DCHeader>
  <DCRecord>
    <DCValue DCNameSpace="http://sap.com/xi/XI/System/File" DCTechnicalName="FileName">Data1.xml</DCValue>
  </DCRecord>
  <DCRecord>
    <DCValue DCNameSpace="http://sap.com/xi/XI/System/File" DCTechnicalName="Directory">./PI_OUT/Files/</DCValue>
  </DCRecord>
  </DCHeader>
  <!-- ACTUAL TARGET STRUCTURE -->
  <Name>Praveen1</Name>
  <EmpID>1234</EmpID>
  <Project>ABC</Project>
  </ns1:MT_Receiver>
  <ns1:MT_Receiver xmlns:ns1="http://pg.com/multimap">
  <!-- ENHANCED DCHeader STRUCTURE for Dynamic Configuration -->
  <DCHeader>
  <DCRecord>
    <DCValue DCNameSpace="http://sap.com/xi/XI/System/File" DCTechnicalName="FileName">Data2.xml</DCValue>
  </DCRecord>
  <DCRecord>
    <DCValue DCNameSpace="http://sap.com/xi/XI/System/File" DCTechnicalName="Directory">./PI_OUT/Files/</DCValue>
  </DCRecord>
  </DCHeader>
  <!-- ACTUAL TARGET STRUCTURE -->
  <Name>Praveen2</Name>
  <EmpID>4567</EmpID>
  <Project>XYZ</Project>
  </ns1:MT_Receiver>
</ns0:Message1>
</ns0:Messages>

That's all. Hope this new solution is simple, efficient and can be useful for your projects. Please share your feedback to improve the code. Thanks..



7 Comments
Labels in this area