cancel
Showing results for 
Search instead for 
Did you mean: 

Mail receiver dynamic subject.

Former Member
0 Kudos

Hi,

I'm looking for a solution (not using mail package) for using data from the payload and putting it in the subject line..

Edited by: Zevik Heinoch on May 17, 2011 1:32 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi,

To set the subject dynamically first set the Adapter specific message attributes in the UDF



public String setSubject(String var1, Container container) throws StreamTransformationException{

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

   DynamicConfigurationKey parmValue;


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

   return var1;
}

In the receiver mail communication channel, go to advanced tab and tick the option of Use Adapter specific Message attributes and the Variable transport binding.

and enter under Variable header 1: THeaderSUBJECT

By this you can have the value from payload as you mail subject.

Regards,

Aravind

Former Member
0 Kudos

Hi Ajnayak,

TX for the help.

where in the code do i specify whice field from the payload i want to use ?

former_member200962
Active Contributor
0 Kudos

var3 mentioned in the above code resembles your field....this field should come as input to the UDF.

I am not sure why he mentioned var1 and var3....also the declaration of var3 seems to be missing in the UDF.

Edited by: abhishek salvi on May 18, 2011 1:22 PM

Former Member
0 Kudos

Hi,

When you use this UDF in the graphicall mapping. you can mapp any one of the required field as the input to this function. So in the code var1 will hold its value.

Sorry, it was a mistake in the above code, instead of var3 its var1



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

Regards,

Aravind

Answers (3)

Answers (3)

fanglin_ye
Participant
0 Kudos

Hello all,

I have a scenario: Idoc (ORDERS) -> XI/PI -> Mail. I have to retrieve data from the payload and putting it in the subject line. For this scenario I don't have message mapping. How can I do this? thx.


best regards,

Fanglin

Former Member
0 Kudos

I had used the below excellent blog by Stefan to generate mail using java mapping.

/people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping

Where yo uwould be having flexibility in setting any mail attributes...

--Divyesh

Former Member
0 Kudos

Tx for all the help, I will check it.

Former Member
0 Kudos

hi,

check this link [http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/frameset.htm]

use an udf for adapter specific message attributes and set the one mentioned there THeaderTO