cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Excel(.xls) file as attachment via receiver Mail Adapter

Former Member
0 Kudos

Hi,

I want to send a excel file as attachment in mail Adapter.i am using an Adapter Module.Inside my module i use the following code snippet to add the attachmnet.

*********************************

attachment.setName("Attachment");

attachment.setContentType("application/vnd.ms-excel");

String temp = "sriram:\thi\n\nsudharshan:\thowz life";

attachment.setContent(temp.getBytes());

msg.addAttachment(attachment);

*********************************

The problem is that though i have set the Content type for xls, still I am getting the attachment with extension .bin.How to get the extension as xls.

Also an extra file(payload)comes along with the attachment.How to avoid this extra file.

Thanks in advance.

Regards,

Sudharshan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sudharshan,

You could also look at the MessageTransformBean and PayloadSwapbean.

http://help.sap.com/saphelp_erp2005/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm -- MessageTransformBean

http://help.sap.com/saphelp_erp2005/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/frameset.htm -- PayloadSwapBean

cheers,

Prashanth

P.S Please mark helpful answers

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sudharshan,

Does the attachment come through properly? You could check that by changing the attachment name(once u recieve it), to .xls and open it with MS-Excel.

Once you are sure that the excel file is coming through properly, then you can try changing the MIME content.

cheers,

Prashanth

P.S please mark helpful answers

Former Member
0 Kudos

Hi,

When I save that attachment as .xls I am able to get proper Excel file.

Only hitch is the extension of the attachment. Hence the recepient is not able to open the attachment and is forced to save it as .xls and check the contents.

Note: Additional attachment that comes by default for payload has been removed by Message Transformation Bean.

Thanks.

Regards,

Sudharshan

Former Member
0 Kudos

Hi All,

Problem is solved.

Sequence of steps:

1.PayloadSwapBean: To swap Payload and attachment.

2.Message Transformation Bean: To send the Payload as attachment with required content type(In my case xls).

3.In Parameters of channel- Without Mail Package and make sure keep attachments check box is unchecked.

Thank u all for ur efforts.

Regards,

Sudharshan

Former Member
0 Kudos

Hi Sudarahsn,

We have similar kind of scenario where XI has to pick up an Excel file and send it as mail to the receipients.From this forum thread, I thinnk I could try to mail Excel file as an attachment.Do you know how we could use XI to pick up Excel file?

Regards

Navin

Former Member
0 Kudos

HI sudhersan,

I have a scenario like same as yours. File to Mail with external attachment. i have file adapter pick up the file from source directory and send as email. what i need is i have another .pdf file in my local drive i have to pick up from local drive and attached to that mail as .pdf. could you please help me this one.

thank you

Regards

Sundher

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Did you have a look at these blogs,

/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure

/people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

I have gone through the blogs.

I want to send mail using Mail Adapter only.

The problem is that i have to construct an Excel File(.xls) out of my payload and send it as attachment in the mail. The problem is that though i am able to send the attachment,the extension is not correct as specified in Content type(MIME).

Any thoughts?

Thanks.

Regards,

Sudharshan

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Have not tried, but you can take a look at Question 8 of the Mail Adapter FAQ : <b>856599</b> and 793922

Regards,

Bhavesh