cancel
Showing results for 
Search instead for 
Did you mean: 

Mail to File - how to read the attachment file name from the subject.

Former Member
0 Kudos

I need to use the SHeaderSUBJECT's value in the receiver file adapter's variable substitution.

This is a Mail to File scenario without design part where the attachment file name comes in the subject of the mail.

I see the below in the dynamicconfiguration section. How can i retrive the value from dynamicconfiguration section to the filename.

<SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

.

.

<SAP:Record namespace="http://sap.com/xi/XI/System/Mail" name="SHeaderSUBJECT">PlainAttachment.txt</SAP:Record>

.

.

</SAP:DynamicConfiguration>

Points will be rewarded.

Accepted Solutions (1)

Accepted Solutions (1)

Jitendra_Jeswan
Contributor
0 Kudos

Hi Sarvanan -

You have to do the following things in order to achieve this. try doing the following :

In the Receiver File Adapter Go to the tab Module and do the following

- Add an Adapter Module DynamicConfigurationBean as the first in the sequence. Assign a module key "1" to it.

- Now in the Module configuration add 2 parameter name, one as "key.0" with value as "write http://sap.com/xi/XI/System/Mail SHeaderSUBJECT" and another paratemer name as "value.0" with value as "message.interface"

Go to the Parameters tab,

- Enable the variable substitution, write variable name as "sheadersubject" with reference as "message:interface_name".

- Use the scheme as "%sheadersubject%" in the file scheme name.

This should give you the desired aouput as PlainAttachment.txt in your case.

Regards.

Jeet

Former Member
0 Kudos

Hi Jeet,

Your solution worked. Thanks a lot.

Thanks for others who replied for my query.

Answers (2)

Answers (2)

former_member187563
Contributor
0 Kudos

hi,

these two blogs may solve your problem:

/people/michal.krawczyk2/blog/2006/10/09/xi-dynamic-configuration-in-adapter-modules--one-step-further

/people/francesco.bersani/blog/2007/03/27/rename-attachment-adapter-module

reward point if useful

regards,

ujjwal kumar

Former Member
0 Kudos

Try to use sthg like this in a UDF :

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().getStreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(“http://sap.com/xi/XI/System/Mail”,“SHeaderSUBJECT”);

String value = conf.get(key);

or in a JAVA mapping :

DynamicConfiguration dynConf = (DynamicConfiguration) param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey dynKey = DynamicConfigurationKey.create((“http://sap.com/xi/XI/System/Mail”,“SHeaderSUBJECT”);

String keyValue = dynConf.get(dynKey);

param is the map object from the execute() method of your mapping ...

Hope this helps

Chris

Edited by: Christophe PFERTZEL on Apr 23, 2008 11:34 AM

Former Member
0 Kudos

Thanks for your soln. Am not using the design part in my interface.

If some one could help me to retrive the value into a variable from the dynamic configuration then it will be helpfull.

Former Member
0 Kudos

Sorry, but I do not understand your "I'm not using the design part ..." statement ? What kind of mapping object are you dealing with (or where do you want to get the key value) ? The above samples can be used either in UDF in graphical mapping tool, or in a JAVA mapping ... It could also be used in XSLT if needed

Chris

Former Member
0 Kudos

I have developed this interface without IR and only in ID.

My requirement is like what ever file(binary) comes in the mail should be delivered as a file in the destination. Since i am not able to get the attachement filename am sending the file name in the subject of the mail.

Former Member
0 Kudos

I guess my brain is still not fully working, cuz I'm still not able to understand how you can develop XI interfaces in XI without "IR" (builder) and only "ID" (directory) ? I'd be happy to get some explainations regarding this, besides the real solution for your issue

Chris

former_member181985
Active Contributor
0 Kudos

Hi Christophe,

We can impelment the scenario with IR part.

It is possible.

All you do is you gave a some random names for Message Interfaces and namespaces in ID while define Collabaration profiles and Agreements.

Once you activate it will deployed into the server just like normal scenarios where in you design objects in IR and use them in ID.

However we cannt assign a mapping program for this case as no mapping exist in the IR part for the given message interfaces. since we have not defined anything in IR.

Thanks

Gujjeti

former_member181985
Active Contributor
0 Kudos

Hi,

Without design part it is not possible.

You can check my reply to Christophe.

Thanks

Gujjeti

former_member181985
Active Contributor
0 Kudos

Hi,

Upon thinking I came up with the following solution.

I guess it should work.

Write an adapter module and use dynamic configuration logic to read the name from mail attachement after that set the FileName attribute of FilleAdapter(again using Dynamic Configuration Logic)

Deploy this module into J2EE engine and use it in your sender Mail adapter in appropriate sequence under modules TAB.

Before you can develop a module check into the help documentation for Mail Adapter and its default module and possiblities.

Execute the scenario. If it works please let me know.

Thanks,

Gujjeti

Former Member
0 Kudos

Hi Gujjeti,

Thanks a lot for helping understand this "IRless" concept ! But now I've another question : what is the purpose (or benefit etc) of such design ? As I've never seen this explained in any SAP documentation, I'd be interested in learning more about it

Cheers

Chris

Edited by: Christophe PFERTZEL on Apr 23, 2008 9:56 PM

former_member181985
Active Contributor
0 Kudos

Hi Christophe,

This concept I have read long back.

Credit goes to this blogger from SAP "William Li".

[https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4383] [original link is broken] [original link is broken] [original link is broken];

Read the blog, you will find lots of intresting information apart from what I explained.

Thanks

Gujjeti

Edited by: Praveen Gujjeti on Apr 23, 2008 10:23 PM

Former Member
0 Kudos

Thank you very much for the tip !

Chris