Home | SAP Object | Thread | CL_DOCUMENT_BCS
Class (ABAP Objects)
» See all 132 related threads
Oct 08 28

Sending Excel as attachment in Email (Unicode)  

09:56 // hank jiang

Hi,

I'm using SO_NEW_DOCUMENT_ATT_SEND_API1 FM to send excel attachments as emails to external addresses.

However, this the SAP upgrade to ECC6.0 from R/3 4.6B

then I cannot open BIG5 char excel, who does know how to sending Unicode excel as attachment in email.

the Excel can show Chinese , BIG5 code ,Japanese ,Korea .

OR which new funciton module in ECC6.0 like SO_NEW_DOCUMENT_ATT_SEND_API1 FM .

Regards,

Hank

 
Oct 08 28

Re: Sending Excel as attachment in Email (Unicode)  

10:06 // Neeraj M

Hey,

try this one.

    lv_string = str_data1.

      cl_bcs_convert=>string_to_solix(

        EXPORTING

          iv_string   = lv_string

          iv_codepage = '4103'  "suitable for MS Excel, leave empty

      iv_add_bom  = 'X'     "for other doc types

        IMPORTING

          et_solix  = binary_content

          ev_size   = size ).

    CATCH cx_bcs.

      MESSAGE e445(so).

  ENDTRY.

        send_request = cl_bcs=>create_persistent( ).

Now  create document object from internal table with text

 

document = cl_document_bcs=>create_document(

          i_type    = 'RAW'

          i_text    = main_text

          i_subject = l_var ).     

                          

       document->add_attachment(

          i_attachment_type    = 'xls'                               i_attachment_subject = ' Details'                      i_attachment_size    = size

          i_att_content_hex    = binary_content ).

  •     add document object to send request

        send_request->set_document( document ).

  •     --------- add recipient (e-mail address) -----------------------

  •     create recipient object

        recipient = cl_cam_address_bcs=>create_internet_address( abc at abc.com).

  •        recipient = cl_cam_address_bcs=>create_internet_address( 'abc at abc.com' ).

  •     add recipient object to send request

        send_request->add_recipient( recipient ).

        sent_to_all = send_request->send( i_with_error_screen = 'X' ).

        COMMIT WORK.

This will definitely work .if any doubts aask me.

Neeraj

Oct 08 30

Re: Sending Excel as attachment in Email (Unicode)  

08:43 // DSME PP

hi, sorry, i can't find 'cl_bcs_convert=>string_to_solix' class in my system , ECC 6.0,

i just found CL_DOCUMENT_BCS class

but i think, it's diifferent.

could you tell me where can i find cl_bcs_convert=>string_to_solix class ?

Dec 08 15

Re: Sending Excel as attachment in Email (Unicode)  

11:19 // Baradakanta Swain

Hi,

    The class cl_bcs_convert is not available below support pack 16. And my guess is if your SAP system has gone through a ECC 6.0 upgrade very recently you probably don't have it.

Anyways we can still send unicode formatted excel attachments in ECC 6 by using the FM 'SO_DOCUMENT_SEND_API1'.

Also SAP note 190669 mentions that you should use the above FM, instead of SO_NEW_DOCUMENT_ATT_SEND_API1 wherever possible.

below is a sample code which i found in another thread to send an excel via the former FM. The encoding here is UTF-8 to support the unicode format in programs.

Note : cl_bcs_convert is a newer and better option to use. So it will be better if you can get it downloaded via SAP notes 1151257 and 1151258.

Please refer this

Send an internal table in Excel format via e-mail

Date Views Headline Answers
23.01.2013 173 abap2xlsx output as mail attachment 7
21.01.2013 111 How to send a mail with XLS attachment using class with subject line > 255. 4
11.01.2013 124 E-Mail Attachment is missing 7
11.01.2013 19 E-Mail Attachment is missing 1
08.01.2013 33 How to send mail with .xlsx/.docu/.txt/.pdf/.doc/.xls docuemnts 1
04.01.2013 79 Variable Column Length of XLS Doc Using Class CL_BCS and CL_DOCUMENT_BCS. 3
07.12.2012 88 Missing line feeds in mail using SO10 standard text converted to ASCII 5

Feedback