cancel
Showing results for 
Search instead for 
Did you mean: 

Sender Mail Adapter (with attachment - text file)

Former Member
0 Kudos

My scenario is Mail (with attachment - text file) > PI > XML File. I'm using PayloadSwapBean to read the attachment and convert the text into xml. I want to know will it convert the text file into xml or I need to put some extra effort? I checked these blogs:
http://scn.sap.com/people/gaurav.agarwal11/blog/2012/04/12/handling-attachments-in-mail-to-file-scen...
&
http://wiki.sdn.sap.com/wiki/display/XI/Step+by+Step+Mail+To+File+Scenario

Please suggest. Thank you so much

Accepted Solutions (1)

Accepted Solutions (1)

nabendu_sen
Active Contributor
0 Kudos

Hi Gopal,

PayloadSwapBean just replace the attachment of the email to a XI payload message. So by default the attachment needs to be a XML for further processing.

You can try to use MessageTransformBean after PayloadSwapBean in Mail Communication Channel - Module and try to convert the text to xml.

If you dont achieve with this, then you need to go for either Custom Adapter Module development or Java Mapping.

Regards,

Nabendu.

Former Member
0 Kudos

Hello Nabendu,
I used MessageTransformBean but its still appearing as text file in Communication Channel.
I have less idea of custom adapter module.

Answers (4)

Answers (4)

Former Member
0 Kudos

Thank you so much to all of you for your time.

Former Member
0 Kudos

PayloadSwapBean+MessageTransformBean worked.. but now content conversion is not working properly. I want to ignore key field.. for that I'm using xml.HEADER1.keyFieldInStructure = ignore. But its not working. Any suggestion. Thank you.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You might want to check this snippet code for converting text format to XML in java

http://stackoverflow.com/questions/9467208/convert-text-file-to-xml-in-java

Once you are done, then rest will be same as you identified.

Former Member
0 Kudos

Hello Baskar,
Can I use it in Graphical mapping as UDF, will it work?

Former Member
0 Kudos

Sorry Baskar, My question is inappropriate. As I'm not good in Java. Will this code work for all kind of Data structure?

ambrish_mishra
Active Contributor
0 Kudos

Hi Gopal,

The payload swap bean will just swap the attachment to the Payload. if the attachment is text, the payload will be text and if it is XML, the payload will be XML. To convert Text to XML, you will need to do Java mapping based on the format of text data.

Hope it helps.

Ambrish