cancel
Showing results for 
Search instead for 
Did you mean: 

How to attach Excel file in Mail Receiver Adapter?

jagesh_lakdawala
Active Participant
0 Kudos

Hello Experts,

In R/3 coding I have Internal Table data available for which i have to generate an Alert mail with Excel file attachment.

This is the scenario of Proxy sender to Mail Receiver. but I don't know how to convert the Internal Table data into Alert mail excel File attachment.

Please suggest me.

Regards,

Jagesh

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

easiest wud be to use an xslt mapping - /people/community.user/blog/2006/09/08/email-report-as-attachment-excelword

jagesh_lakdawala
Active Participant
0 Kudos

hi Shabarish,

Can we do the same by using the Standard Mail External definnation by specifying the Content Type and Content??

Please suggest

Regards,

Jagesh

Shabarish_Nair
Active Contributor
0 Kudos

in your case you are required to create a excel file. The XSLT mapping does exactly the same.

Else another option is to write a module or implement a java mapping that will implement the same.

If your excel is not too complicated i suggest follow the blog.

jagesh_lakdawala
Active Participant
0 Kudos

Hi Shabarish,

I can understand ur idea for this.

but i have already one of the scenario with External Mail Defrination is developed previously and i want to utilize the same.

i have refered the forum..

My only doubt in this:- How to convert my internal table data in CONTENT tag???

Regards,

jagesh

Shabarish_Nair
Active Contributor
0 Kudos

use XSLT mapping for the content tag to create the excel.

the thread you refered does the same

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

As suggested you need to use XSLT jst to format the output in the excel sheet. Alternately you can just concat all the fields from the source and map it to the content, however you excel will not be formatted in row,column format instead all the fields will occur in a same cell. So use the XSLT mapping to have a formatted output.

Thanks,

SaNv...

jagesh_lakdawala
Active Participant
0 Kudos

Hi Santhosh,

Thanks for your suggestion.

But without using XSLT mapping also, I have generated the Excel File attachment.

Throgh R/3 coding I am passing following.

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-FROM = From Mail Address.

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-TO = TO Mail Address.

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-SUBJECT = 'Test Alert mail'.

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-DATE = SY-DATUM.

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT_TYPE = 'text/plain;name="CSV_data.csv"'.

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT = 'Testing1,Testing2,Testing3'.

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT_DISPOSITION = 'attachment'.

And in the Mail Receiver Adapter i have configured as following.

Use Mail package and Keep Attachment both options are selectd.

So I am getting the data in different columns in the excel file But How to set the Next ROW in Excel file?

I thnk i am missing something in CONTENT value.

Regards

Jagesh

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

In CSV file rows are separated by newlines. So try inserting a manual line break in ABAP code.

Thanks,

SaNv...

jagesh_lakdawala
Active Participant
0 Kudos

Hi Santhosh,

I tried as following in Coding:-

G_ALERT_INPUT-MT_R3REQUEST_MAIL_SEND-MAIL-CONTENT = 'Cell 1.1,Cell 1.2,nl,Cell 2.1'.

I Wanted Text Cell 2.1 in the next row of the Excel file but i am getting output as following.

Cell 1.1 Cell 1.2 nl Cell 2.1

All 4 Text in same row with 4 columns.

Please suggest me the proper Line Break character to be use in this case..

Regards,

Jagesh

jagesh_lakdawala
Active Participant
0 Kudos

Hello Experts,

Please suggest in this.

Regards,

Jagesh

jagesh_lakdawala
Active Participant
0 Kudos

Dear Santhosh,

Finally I have got the solution for inserting the Line Break in attached Excel file without using the XSLT mapping.

In the R3 coding I have done as shown below.

concatenate Field1.1 ',' Field1.2 ',' CL_ABAP_CHAR_UTILITIES=>NEWLINE into String1

concatenate String1 Field2.1 ',' Field2.2 ',' CL_ABAP_CHAR_UTILITIES=>NEWLINE into String1.

Finally I assined the String1 to Content.

Content Type = 'application/vnd.ms-excel;name=TestFile.CSV'

Now In excel it is showing like.

Field1.1 Field1.2

Field2.1 Field2.2

So I am closing this Thread now.

Regards,

Jagesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Check...might help

/people/community.user/blog/2006/09/07/email-reporting

/people/community.user/blog/2006/09/08/email-report-as-attachment-excelword