Skip to Content

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.

ModuleList.JPG

With the below settings in Module Configuration.

ModuleConfig.JPG

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.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

    1. Varun Mukund Post author

      Hi Eng Swee Yeoh

      I’m wondering whether an XSL transformation using the MessageTransformBean could do the trick. I’m feeling too lazy today to try this out, but theoretically I believe it should work. What say?

      (0) 
      1. Eng Swee Yeoh

        Hi Varun

        I’m not really an XSL guy but it might be possible. Try it out on one of your non-lazy days and let us know how it goes. If it works, it will be quite worthy of a blog post 😉

        Rgds

        Eng Swee

        (0) 
  1. Ganesh Gullipalli

    Hi Varun,

    Thanks for sharing …as i got knowledge on handle multiple filenames.but had doubt that,

    Can we do the same in single JMS channel that will holds each values in Header for each message split. your help much appreciated .

    Thanks in advance ..

    Regards,

    Ganesh

    (0) 

Leave a Reply