Quantcast
Channel: SCN: Message List - ABAP Development
Viewing all articles
Browse latest Browse all 10425

Re: Error in opening Excel attachment in mail

$
0
0

Hello Rafi:

 

I also ran into a similar situation recently.

 

Here is what I did  & This works for me.

 

I created a .CSV file and it will open up as an excel sheet when you double click on  it.

 

 

*     -------- create and set document with attachment ---------------

*     create document object from internal table with text

      WRITE: sy-datum TO l_date MM/DD/YYYY.

      CONCATENATE 'Invoices' l_date INTO l_subject SEPARATED BY space.

      APPEND l_subject TO main_text.

 

 

DATA :    lv_text_line TYPE soli,

                      lt_att_head TYPE soli_tab.

 

 

       document = cl_document_bcs=>create_document(

         i_type    = 'RAW'

         i_text    = main_text

         i_subject = filem ).                                "#EC NOTEXT

*     add the spread sheet as attachment to document object

 

       CONCATENATE '&SO_FILENAME='

'FileName' '.CSV' INTO lv_text_line.

       APPEND lv_text_line TO lt_att_head.

       document->add_attachment(

         i_attachment_type    = 'CSV'                        "#EC NOTEXT

         i_attachment_subject = filen                        "#EC NOTEXT

         i_attachment_size    = size

         i_att_content_hex    = binary_content

         i_attachment_header = lt_att_head ).

 

Let me know if this change works for you.

 

 

Thanks

Gayathri


Viewing all articles
Browse latest Browse all 10425

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>