on 03-25-2011 6:44 AM
Hi Everybody,
I have to fill the subject of mail with the value in the input tag <id> , i have tried this code to set the subject but dont knwo how to extract the field to fill.
DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Mail", "THeaderSUBJECT");
conf1.put(key1, "Test");
return "";
please suggest me some UDF to proceed further.
Thanks
I think you have Receiver Mail Adapter and want to pass Subject value from one of your source field value..
following links will help you..
http://help.sap.com/saphelp_nw04/Helpdata/EN/6b/4493404f673028e10000000a1550b0/content.htm
Thanks,
Bhupesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did you miss out declaring the trace object?
You have to declare the trace before using it.
AbstractTrace trace = container.getTrace();
then
trace = (AbstractTrace) param.get(StreamTransformationConstants.MAPPING_TRACE);
In the receiver mail channel you even have to enter the Variable transport binding:
In the advance tab. tick use adapter specific message attributes and the Variable transprot binding.
then under Variable Header Name1 : enter: THeaderSUBJECT
Then it will work
Regards,
Aravind
Hi,
Try this in UDF:
public String setSubject(String var1, Container container) throws StreamTransformationException
{
/*** get the subject in the Var1 ***/
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
/*** set the Subject of the mail ***/
parmValue = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Mail", "THeaderSUBJECT");
conf.put(parmValue, var1);
}
Then set the Variable Transport binding in the Advanced Tab of receiver Mail channel under Adapter specific Message Attributes:
Variable Header (Name1) : THeaderSUBJECT
Refer:
http://help.sap.com/saphelp_nw70/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
Regards,
Aravind
Hi Aravind,
I tried the code you have provided but in the subject of the mail im getting as "Testmssgid".
Im mapping the input tag <ID> with the output tag <subject> with the UDF in between.
The input parameter to the UDF is ID
still Im getting subject in the mail as Testmssgid.
Please suggest me as what change I need to do.
Thanks
Hi,
Have you set the Variable Transport Binding Parameter in the Receiver Mail Channel?
Without setting this you wont get the subject value set in the UDF.
And check if you are setting the correct variable in the code:
conf.put(parmValue, var1); // var1 should be the value from the tag <ID>
Regards,
Aravind
Hi,
I don't think you can skip returning a string from a udf.
So the alternative for this is create a variable on the target structure in the Message Mapping. Then map the out put of the udf to this variable.
To create a variable:
In the Message mapping, in target structure. Right click on any of the node or field and click on "Add Variable". Give a variable name. Then Double click on this variable (not click and drag). Then map the out put of the udf to this variable.
Refer: /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
The value of the variable does not actually reflect on the target payload. So this should solve your problem.
Regards,
Aravind
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.