on 04-11-2014 6:08 AM
Hi
wondering how I can approach this problem. I have to read an Email with any number of attachments - it can have between 1 and 4 or maybe more of different types (CSV,XLS,PDF,ZIP). I need to read this email and extract the attachments to a folder.
Just to let you know I have done this OK for an email that I know only has 2 attachments ! Works perfectly - just no good for ?n? attachments !
Mail Sender has AF_Modules/MultipartHeaderBean to add payload Attributes
The message is sent to 2 Receivers
Each Receiver File adapter then uses AF_Modules/DynamicConfigurationBean and AF_Modules/PayloadSwapBean
Problem is that when I do not know how many attachments there are. So I will have to write a Java UDF mapping, perhaps using the classTransformationInput.
My question is : To create a Java UDF what should be structure of a sent Email message Type look like so I can feed that into a UDF to check what payload attachments there are etc ?.
Hi Jonny,
Is target directory common for all file types (attachments)?
If Yes, you can use payloadzipbean in sender mail adapter and then pass the entire single zip file to target folder. Use some script to extract the zip file
Regards,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jonny,
plz chk the below link .(This link help of the 80% for u ...)
http://scn.sap.com/docs/DOC-34713
Regards,
Mutti .
Indeed, that is standard behavior of payloadzip bean. May be you can try with my article:
Attachments zipping during Mapping
to zip attachments using a UDF or a java mapping which allows you to have original file names.
Best Regards,
Praveen Gujjeti
As long as you use java mapping, you can have any dummy structures for your interfaces.
But, if you prefer to use graphical mapping with UDF, then you should have some valid structures for your mail and file interfaces. e.g., mail pack XSD for mail interface as metioned by Indrajit Sarkar
and again the same structure for the file interface as well so that you can have one to one mapping an then make use of UDF code from the article. Use payload swap bean in the receiver file channel to replace xml payload with Zipped attachments and then finally use script to unzip this zip file.
Rgds,
Praveen Gujjeti
Hi Jhonny
You can use the standard mail package as the message type while sending the email to PI.
I think the same scenario will work if you use any dummy interface as well when sending the
email.
Only you need to write a java mapping to look for the attachment and save them in a directory.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for the tip !. I need some type of source message structure - so I could use a simple Blob structure ? So now on further research so far it seems that the Message Type must be named as ‘Mail
’ and it must be present under the Namespace ‘http://sap.com/xi/XI/Mail/30’
.
http://www.riyaz.net/sap/xipi-sending-emails-using-xi-mail-adapter/83/
Hi Jonny
Yes that is the standard mail package structure provided by sap. The XSD of the mail package is provided as an attachment in SAP Note 748024.
Please check the doc below for more details
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.