07-15-2011 8:05 AM
Hi Friends,
My Requirement is i have a three internal table with contain data , that data send mail to the particular email id's through report with excel attachment. This Excel Work book contain three sheet with three internal table data. I have report that generate Excel with multiple sheet but it open dynamically when i execute and doing save manually how it is saved automatically and how it send to with attachment.
07-15-2011 12:46 PM
The best method would be save the excel sheet with three sheets in .html format. Go through the HTML code generated, the same code can be used to create the table of data to be sent through the mail sending FM/Method and the file type needs to be set as excel. I have used this method once. There are documents available over the net. Use key words OLE ABAP EXCEL MULTIPLE to search for the document.
Thanks,
Saravanan R
07-15-2011 11:54 PM
Hi Santu,
using [Desktop Office Integration|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIOFFI/BCCIOFFI.pdf] we can save the excel to a local file, upload it in binary format and attach it to a BCS mail object.
CALL METHOD document->create_document
EXPORTING
open_inplace = open_inplace
create_view_data = create_view_data
onsave_macro = onsave_macro
startup_macro = startup_macro
document_title = document_title
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
...
CALL METHOD document->save_as
EXPORTING
file_name = file_name
prompt_user = prompt_user
no_flush = no_flush
IMPORTING error = error
retcode = retcode.
...
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = file_name
filetype = 'BIN'
IMPORTING
filelength = lf_filelength
CHANGING
data_tab = lt_datatab
EXCEPTIONS
OTHERS = 1.
...
data: lo_document TYPE REF TO cl_document_bcs.
lo_document = cl_document_bcs=>create_document(
...
TRY.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = att_type
i_att_content_text = lt_datatab
i_attachment_size = i_lenght
i_attachment_subject = subject.
CATCH cx_bcs INTO bcs_exception.
*Error Message
ENDTRY.
...
Just roughly. Search SCN and complete.
Regards,
Clemens
07-18-2011 7:56 AM
Hi Clemens,
Thanks for replying
Please give me a sample report My requirement is The program will run in background and will send an email with attached excel sheet with multiple worksheets to specified email addresses.
07-18-2011 11:18 AM
Hi Santu,
sorry, I am nor a Sample developer. But I'm convinced you can find and combine solutions on SCN and elsewhere.
Regards,
Clemens
07-18-2011 11:57 PM
07-19-2011 3:20 PM
Hi,
Clemens
Thanks for your reply.
I done it different way using XML.
07-19-2011 3:34 PM
Problem Solved. I done it Using XML for sending multiple Excel attachment.
03-02-2012 12:01 PM
Hi Santu,
Could you please help me with Sample code.
I have a same kind of requirement
Regards
11-01-2012 12:41 PM
could you just give me a sample code....I have a same requirements.
01-13-2021 10:34 AM
06-19-2013 8:23 AM