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_member192892
Active Contributor

Fellow SCNers,

All of us at one point of time in our career as SAP PO consultants would have have faced a requirement needing multimapping and to go with it a need for dynamic file name after multimapping. And at the same time, we would have realized that we cannot assign ASMA using a UDF in case of multimapping.

This blog does not intend to showcase any hidden functionality which makes it possible as it is still not possible to do a 1:N multimapping without using custom solutions. One such solution has been brilliantly showcased by my friend praveen.gujjeti in A new approach: Multi-mapping Dynamic Configuration using a generic custom module

However, it is possible to do multimapping and Dynamic Configuration in cases of 1:N multimapping if the value of N is known and fixed. I have achieved this to Dynamically assign ASMA values to child messages in case of a 1:5 split.

I would like to mention our colleague and guru stefan.grube whose blog Unknown use case of DynamicConfigurationBean: Store file name to JMS header without mapping showed me the light for the approach.

Solution:

In your multimapping program, insert a UDF having the below code snippet. Please note that the you can increase the number of DynamicConfigurationKey objects based on the number of messages you have in your target.

public String putFileName(String inputFileName1, String inputFileName2, String inputFileName3, String inputFileName4, String inputFileName5, Container container) throws StreamTransformationException{

try {

  DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

  DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Test","Message1");

  DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Test","Message2");

  DynamicConfigurationKey key3 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Test","Message3");

  DynamicConfigurationKey key4 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Test","Message4");

  DynamicConfigurationKey key5 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Test","Message5");

  conf.put(key1,inputFileName1);

  conf.put(key2,inputFileName2);

  conf.put(key3,inputFileName3);

  conf.put(key4,inputFileName4);

  conf.put(key5,inputFileName5);

  return "";

}

catch(Exception e){

return "Could not write filename";

}

And then, in your receiver communication channels(Assuming you will have different communication channels to process each of the split messages) you need to maintain the below entries in the module tab.

With the below settings in Module Configuration.

And that's it!!! The above example pick the value assigned to Dynamic Configuration Key Message3 from mapping to DCJMSMessageProperty0 attribute of the JMS adapter. Similar thing can be done for the attributes of File adapter to dynamically name the files at receiver end.

4 Comments
Labels in this area