08-27-2015 1:49 PM
Hi all,
i upload a XLSX file and send it with class CL_DOCUMENT_BCS to web Email adress. This works fine, but the file in the email is corrupt, if you open the XLSX file Excel display a popup that the file is corrupt and asks if i like to repair the file, this works and the file is then correct. But what is going wrong with the initialy correct xlsx file between workstation upload and send via email?
Here the short code:
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = p_file " TYPE string DEFAULT 'C:\Temp\OP_LIST.xlsx'.
filetype = 'BIN'
CHANGING
data_tab = t_data. " TYPE solix_tab
* set correct file extension
APPEND INITIAL LINE TO t_att_header ASSIGNING FIELD-SYMBOL(<lw_att_header>).
<lw_att_header> = '&SO_FILENAME=OP_LIST.XLSX'.
CALL METHOD:
document->add_attachment
EXPORTING
i_attachment_type = 'RAW' " BIN XLS XML -> allways same result
i_attachment_subject = 'My attachment'
i_att_content_hex = t_data
i_attachment_header = t_att_header,
Thanks for help!
Wolfgang
08-27-2015 2:16 PM
Hi,
I think you have to send the document size in I_ATTACHMENT_SIZE in the ADD_ATTACHMENT method.
So calculate the size of t_data table (check the exporting parameters FILELENGTH / HEADER in GUI_UPLOAD Method ) and pass it the method.
R
08-27-2015 2:16 PM
Hi,
I think you have to send the document size in I_ATTACHMENT_SIZE in the ADD_ATTACHMENT method.
So calculate the size of t_data table (check the exporting parameters FILELENGTH / HEADER in GUI_UPLOAD Method ) and pass it the method.
R
08-27-2015 2:50 PM
So easy, so long searching for a solution, the missing document size was the missing paramter! thanks Roy!