Application Development and Automation 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: 
Read only

Email attachment size issue!!

Former Member
0 Likes
3,559

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!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,332

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!

7 REPLIES 7
Read only

Former Member
0 Likes
2,332

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

Read only

0 Likes
2,332

Hi Nick,

Program doesnot create any unecessary space in the file or worksheet. It is only populating data progressively from internal table.

Read only

0 Likes
2,332

Hi Gaurav,

  Could you please send the code for building excel file.

Regards,

Srikanth

Read only

sarat_malladi
Explorer
0 Likes
2,332

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 ).

Read only

Juwin
Active Contributor
0 Likes
2,332
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

Read only

Former Member
0 Likes
2,333

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

Read only

Juwin
Active Contributor
0 Likes
2,332

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