Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating an excel file with multiple sheets and send it as an attachment

Former Member
0 Kudos

Hi Friends,

I have copied a report 'ZMULTIEXCEL' from www.sapdev.co.uk site.

I would like to create an excel file with multiple sheets through an abap report and attach to an email and I have to send that excel file. But when I am going to run the report, excel has been created successfully and also dynamically excel file is opening. But I don't want to open excel file dynamically.

I want to attach that excel file to an email id. Could you please help me?.

3 REPLIES 3

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hello.

When having created an Excel-file via OLE, just do the following:

1) Save it

You may generate the file-name dynamically, eg. using the timestamp information. You will save it somewhere on the client...

2) Close it

Like shown in ZMULTIEXCE, or you replace

CALL METHOD OF workbook 'Add'.

with

CALL METHOD OF workbook 'Add' = single_wb.

Then you can close the workbook with

CALL METHOD OF single_wb 'Close'.

3) Import

Import the file via CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD, using filetype = BIN, into an internal table

it_data TYPE solix_tab

4) Send as an email

I would suggest to use class CL_BCS (therefore the above definition of the external table), see examples in package SBCOM

Hope this helps,

Greetings.

Former Member
0 Kudos

Could you please provide any example report, if possible. Thank you for your reply.