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: 
pooja_tiwari3
Participant
0 Kudos

Hi All,

Many times we have requirements like make the attachment name different received via mail adapter.

So here is the blog to resolve the problem:

First write a UDF for the same:

Taks 2 strings for arguments which you want to add in the name of attachement:

ex :Args1,Args2 :

////////////

public String Dynamicfilename(String Args1, String Args2, Container container) throws StreamTransformationException{

String tempstart = "string1";

   DynamicConfigurationKey parmValue;

String tempend = ".txt";

String hypen = "-";

String FileName = "XHeaderName3";

String Subject =  tempstart +hypen+ VBELN +hypen+ GLN;

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

if (conf != null)

{

DynamicConfigurationKey keyFilename = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/Mail",  "XHeaderName1");

String dynaname = tempstart +hypen+ Args1 +hypen+ Args2+tempend;

String dyn1 = "attachment; filename =" +dynaname;

conf.put(keyFilename, dyn1);

parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Mail", "THeaderSUBJECT"); 

         conf.put(parmValue,  Subject);

container.setParameter(StreamTransformationConstants.DYNAMIC_CONFIGURATION, conf);

}

return "";

}

after writing the UDF,map the root node of output structure with UDF along with 2 input fields.

now go to receive MAIL adapter communication channel.

and make changes like this;

1. Use ASMP-checked

2.Variable Transport Binding-checked

here  THeaderSUBJECT is the value which we have set in UDF.

Now add these modules and values to the communication channel:

I hope this will help .

References : Adding DynamicConfigurationBean in the Module Processor - SAP NetWeaver Process Integration - SAP Li...

Happy Learning :smile:

Thanks,

Pooja Tiwari

3 Comments
Labels in this area