2015 Aug 06 9:39 AM
Hi,
I have developed a tool where some data is sent to excel sheet through xml conversion as an attachment to various users.
However if you manually create the same file, size is around ~2 MB but when i create the file through the tool, file size is around ~12 MB due to which mails are not being pushed from SOST.
Please help here!
2015 Aug 07 9:42 AM
Hi All,
I have used the code same as in below mentioned URL.http://www.saptechnical.com/Tutorials/ABAP/OLE/code.txt
Attachment create is in XLS format.
Please help if it can reduced to lesser size.
Thanks in advance.
Regards,
Gaurav
Hi,
I have developed a tool where some data is sent to excel sheet through xml conversion as an attachment to various users.
However if you manually create the same file, size is around ~2 MB but when i create the file through the tool, file size is around ~12 MB due to which mails are not being pushed from SOST.
Please help here!
2015 Aug 06 9:47 AM
Hi,
Excel is sensitive to blank space, so if I create a spread sheet containing a single X in one cell the file size will be larger if it is in row 999 column ZZ then if it is in row 1 column A.
Check your creation program to ensure it's not padding out the file with unnecessary space.
Regards,
Nick
2015 Aug 06 9:56 AM
Hi Nick,
Program doesnot create any unecessary space in the file or worksheet. It is only populating data progressively from internal table.
2015 Aug 06 12:40 PM
Hi Gaurav,
Could you please send the code for building excel file.
Regards,
Srikanth
2015 Aug 06 12:53 PM
Hi,
You can either try to ZIP the excel using the below code:
data: l_zipper TYPE REF TO cl_abap_zip,
l_filename TYPE string,
l_zip TYPE xstring,
l_excel_name1 TYPE so_obj_des,
l_buffer TYPE xstring.
** get the excel data in to l_excel:
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = l_excel
IMPORTING
buffer = l_buffer.
CALL METHOD l_zipper->add
EXPORTING
name = l_filename
content = l_buffer.
* Save zip
CALL METHOD l_zipper->save
RECEIVING
zip = l_zip.
* Convert Xstring into Binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_zip
TABLES
binary_tab = lt_att_comm_content_hex.
**add the zipped excel to mail
l_document->add_attachment( i_attachment_type = text-m60 " ZIP
i_attachment_subject = l_excel_name
i_att_content_hex = lt_att_comm_content_hex ).
2015 Aug 06 1:57 PM
excel sheet through xml conversion This can result in XML file or XLSX file. Please post the code which you are using to create the file.
If XML file, then the file size will be huge and zipping it would be the only option. If using XLSX file, the file is already zipped and still if you are getting huge file, then you will have to try and reduce the data content.
Thanks,
Juwin
2015 Aug 07 9:42 AM
Hi All,
I have used the code same as in below mentioned URL.http://www.saptechnical.com/Tutorials/ABAP/OLE/code.txt
Attachment create is in XLS format.
Please help if it can reduced to lesser size.
Thanks in advance.
Regards,
Gaurav
2015 Aug 07 12:33 PM
Hi Gaurav, This is not XLS format, this is XML spreadsheet format. It creates huge files because of the tags. I think you have 2 options here - either change the code to create XLSX format or add zipping functionality to your code so that the file you currently have is zipped before attaching to email.
Thanks