<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: BCS_EXAMPLE_7 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188584#M1374262</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's the coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
report bcs_example_7.

* This report provides an example for sending an Excel
* attachment in Unicode Systems

constants:
  gc_tab  type c value cl_bcs_convert=&amp;gt;gc_tab,
  gc_crlf type c value cl_bcs_convert=&amp;gt;gc_crlf.

parameters:
  mailto type ad_smtpadr .               "Enter a default email address

data send_request   type ref to cl_bcs.
data document       type ref to cl_document_bcs.
data recipient      type ref to if_recipient_bcs.
data bcs_exception  type ref to cx_bcs.

data main_text      type bcsy_text.
data binary_content type solix_tab.
data size           type so_obj_len.
data sent_to_all    type os_boolean.

start-of-selection.
  perform create_content.
  perform send.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I guess, when you sent an attachment, the whole file will be attached and sent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Sep 2009 09:53:32 GMT</pubDate>
    <dc:creator>Sm1tje</dc:creator>
    <dc:date>2009-09-29T09:53:32Z</dc:date>
    <item>
      <title>BCS_EXAMPLE_7</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188583#M1374261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refer to SAPnote 1151258 report BCS_EXAMPLE_7 is not in our system. Can someone from the community provide it? The next question is if it is possible to send files with more than one worksheet via mail from ABAP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Norbert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 09:20:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188583#M1374261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T09:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: BCS_EXAMPLE_7</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188584#M1374262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's the coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
report bcs_example_7.

* This report provides an example for sending an Excel
* attachment in Unicode Systems

constants:
  gc_tab  type c value cl_bcs_convert=&amp;gt;gc_tab,
  gc_crlf type c value cl_bcs_convert=&amp;gt;gc_crlf.

parameters:
  mailto type ad_smtpadr .               "Enter a default email address

data send_request   type ref to cl_bcs.
data document       type ref to cl_document_bcs.
data recipient      type ref to if_recipient_bcs.
data bcs_exception  type ref to cx_bcs.

data main_text      type bcsy_text.
data binary_content type solix_tab.
data size           type so_obj_len.
data sent_to_all    type os_boolean.

start-of-selection.
  perform create_content.
  perform send.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I guess, when you sent an attachment, the whole file will be attached and sent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 09:53:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188584#M1374262</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-09-29T09:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: BCS_EXAMPLE_7</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188585#M1374263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Part Two of the coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  send
*&amp;amp;---------------------------------------------------------------------*
form send.

  try.

*     -------- create persistent send request ------------------------
      send_request = cl_bcs=&amp;gt;create_persistent( ).

*     -------- create and set document with attachment ---------------
*     create document object from internal table with text
      append 'Hello world!' to main_text.                   "#EC NOTEXT
      document = cl_document_bcs=&amp;gt;create_document(
        i_type    = 'RAW'
        i_text    = main_text
        i_subject = 'Test Created By BCS_EXAMPLE_7' ).      "#EC NOTEXT

*     add the spread sheet as attachment to document object
      document-&amp;gt;add_attachment(
        i_attachment_type    = 'xls'                        "#EC NOTEXT
        i_attachment_subject = 'ExampleSpreadSheet'         "#EC NOTEXT
        i_attachment_size    = size
        i_att_content_hex    = binary_content ).

*     add document object to send request
      send_request-&amp;gt;set_document( document ).

*     --------- add recipient (e-mail address) -----------------------
*     create recipient object
      recipient = cl_cam_address_bcs=&amp;gt;create_internet_address( mailto ).

*     add recipient object to send request
      send_request-&amp;gt;add_recipient( recipient ).

*     ---------- send document ---------------------------------------
      sent_to_all = send_request-&amp;gt;send( i_with_error_screen = 'X' ).

      commit work.

      if sent_to_all is initial.
        message i500(sbcoms) with mailto.
      else.
        message s022(so).
      endif.

*   ------------ exception handling ----------------------------------
*   replace this rudimentary exception handling with your own one !!!
    catch cx_bcs into bcs_exception.
      message i865(so) with bcs_exception-&amp;gt;error_type.
  endtry.

endform.                    "send

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  create_content
*&amp;amp;---------------------------------------------------------------------*
* Create Example Content
* 1) Write example text into a string
* 2) convert this string to solix_tab
*----------------------------------------------------------------------*
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 09:55:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188585#M1374263</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-09-29T09:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: BCS_EXAMPLE_7</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188586#M1374264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Part three:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
form create_content.

  data lv_string type string.
  data ls_t100 type t100.

* --------------------------------------------------------------
* as example content we use some system messages out of t100
* get them for all installed languages from db
* and write one line for each language into the spread sheet

* columns are separated by TAB and each line ends with CRLF

  concatenate 'This Is Just Example Text!'                  "#EC NOTEXT
              gc_crlf gc_crlf
              into lv_string.

* header line
  concatenate lv_string
              'MSGID'    gc_tab
              'MSGNO'    gc_tab
              'Language' gc_tab                             "#EC NOTEXT
              'Text'     gc_crlf                            "#EC NOTEXT
              into lv_string.

* data lines
  select * from t100 into ls_t100
    where arbgb = 'SO' and msgnr = '182'.

    concatenate lv_string
                ls_t100-arbgb gc_tab
                ls_t100-msgnr gc_tab
                ls_t100-sprsl gc_tab
                ls_t100-text  gc_crlf
                into lv_string.

  endselect.

  select * from t100 into ls_t100
    where arbgb = 'SO' and msgnr = '316'.

    concatenate lv_string
                ls_t100-arbgb gc_tab
                ls_t100-msgnr gc_tab
                ls_t100-sprsl gc_tab
                ls_t100-text  gc_crlf
                into lv_string.

  endselect.

* --------------------------------------------------------------
* convert the text string into UTF-16LE binary data including
* byte-order-mark. Mircosoft Excel prefers these settings
* all this is done by new class cl_bcs_convert (see note 1151257)

  try.
      cl_bcs_convert=&amp;gt;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.

endform.                    "create_content

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Partial code because of formatting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 09:56:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188586#M1374264</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-09-29T09:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: BCS_EXAMPLE_7</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188587#M1374265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Last part:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*---------------------------------------------------------------
* NOTES:
*---------------------------------------------------------------
* UTF-16LE including the BOM (Byte order mark)
* is preferred by Microsoft Excel. If you want to create
* other binary content you may choose another codepage (e.g.
* '4110' (UTF-8) which is standard for e-mails).
* Find SAP codepage names in the drop down list
* for the codepage setting of node SMTP in transaction SCOT.
* Or: leave iv_codepage and iv_add_bom empty. Then the target
* codepage is set according to SAPconnect settings
*
* Important:
* SAP neither guarantees that the attachment created
* by this report can be opened by all Excel Versions nor
* that it can be opened by any 3rd party software at all
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 09:57:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188587#M1374265</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2009-09-29T09:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: BCS_EXAMPLE_7</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188588#M1374266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Micky,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   I have implemented the code and working fine. But would like to avoid Read receipt functionality from outlook and only attachment should send it to individual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  How do we avoid read receipt from the standard method?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate all your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;PArtha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 06:30:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bcs-example-7/m-p/6188588#M1374266</guid>
      <dc:creator>former_member183880</dc:creator>
      <dc:date>2011-12-01T06:30:06Z</dc:date>
    </item>
  </channel>
</rss>

