<?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 Add Attachment in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661264#M1096602</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i try to Add attachment to mail the i send (i use class bcs) ,&lt;/P&gt;&lt;P&gt;and i have &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; document-&amp;gt;add_attachment( EXPORTING i_attachment_type    = 'RAW'    " First Attachment&lt;/P&gt;&lt;P&gt;                                        i_attachment_subject = 'attach1.txt'&lt;/P&gt;&lt;P&gt;                                        i_att_content_text   = lt_attach ).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Oct 2008 10:40:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-28T10:40:03Z</dc:date>
    <item>
      <title>Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661264#M1096602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i try to Add attachment to mail the i send (i use class bcs) ,&lt;/P&gt;&lt;P&gt;and i have &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; document-&amp;gt;add_attachment( EXPORTING i_attachment_type    = 'RAW'    " First Attachment&lt;/P&gt;&lt;P&gt;                                        i_attachment_subject = 'attach1.txt'&lt;/P&gt;&lt;P&gt;                                        i_att_content_text   = lt_attach ).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 10:40:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661264#M1096602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T10:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661265#M1096603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ferry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have  you had already a look at sample report &lt;STRONG&gt;BCS_EXAMPLE_5&lt;/STRONG&gt; ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT bcs_example_5.

* This example shows how to send
*   - a simple text provided in an internal table of text lines
*   - and an attached MS word document provided in internal table
*   - to some internet email address.
*
* All activities done via facade CL_BCS!
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 10:43:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661265#M1096603</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-10-28T10:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661266#M1096604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is the problem you are facing..?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 10:44:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661266#M1096604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T10:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661267#M1096605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry i don't complete my first massge .&lt;/P&gt;&lt;P&gt;when i run the progarm i get dump.&lt;/P&gt;&lt;P&gt;this is what i get:&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;An exception occurred that is explained in detail below.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  &lt;STRONG&gt;caught and&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;therefore caused a runtime error.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;The reason for the exception is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;An attempt was made to access a component (variable: "DOCUMENT") with a 'ZERO&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;object reference (points to 'nothing').&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;An object reference must point to an object (an instance of a class)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;before it can be used to access a component.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;Either the reference has not yet been set or it was set to 'ZERO' using&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;a CLEAR statement.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND 'Test Attachment' TO lt_attach.

 document-&amp;gt;add_attachment( EXPORTING i_attachment_type    = 'RAW'    " First Attachment
                                        i_attachment_subject = 'Test'
                                        i_att_content_text   = lt_attach
                                        i_attachment_size = '21' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what i miss here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 10:44:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661267#M1096605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T10:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661268#M1096606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
document-&amp;gt;add_attachment( EXPORTING i_attachment_type    = 'RAW'    " First Attachment
                                        i_attachment_subject = 'Test'
                                        i_att_content_text   = lt_attach
                                        i_attachment_size = '12' ).  "try with 12&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also check the example mentioned above by UWE it is a good example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you create the document object..?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vijay Babu Dudla on Oct 28, 2008 6:48 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 10:47:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661268#M1096606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T10:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661269#M1096607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ferry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before using the document instance you need to create it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*---------------------------------------------------------------------*
*       FORM main                                                     *
*---------------------------------------------------------------------*
FORM main.

  try.
*     -------- create persistent send request ------------------------
      send_request = cl_bcs=&amp;gt;create_persistent( ).

*     -------- create and set document with attachment ---------------
*     create document from internal table with text
      APPEND 'Hello world!' TO text.
      document = cl_document_bcs=&amp;gt;create_document(
                      i_type    = 'RAW'
                      i_text    = text
                      i_length  = '12'
                      i_subject = 'test created by BCS_EXAMPLE_2' ).

*     add attachment to document
*     BCS expects document content here e.g. from document upload
*     binary_content = ...
      CALL METHOD document-&amp;gt;add_attachment
        EXPORTING  i_attachment_type = 'DOC'
                   i_attachment_subject = 'My attachment'
                   i_att_content_hex    = binary_content.

*     add document to send request
      CALL METHOD send_request-&amp;gt;set_document( document ).
...
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 10:50:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661269#M1096607</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-10-28T10:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661270#M1096608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; i try to Change the number like u write and i have the same error .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 10:52:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661270#M1096608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T10:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661271#M1096609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;did you check the example program BCS_EXAMPLE_5, if you are still getting the error post the code. did you call the method create_document inside your program.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 11:06:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661271#M1096609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T11:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661272#M1096610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Uwe ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks i Try your code (bcs_example_5) and i don't get dump!&lt;/P&gt;&lt;P&gt;the problem now is that i dont get the attchment (i get the mail)  ,maybe u have idea ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 11:15:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661272#M1096610</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T11:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661273#M1096611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try to pass some attachement and see.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD document-&amp;gt;add_attachment
        EXPORTING  i_attachment_type = 'DOC'
                   i_attachment_subject = 'My attachment'
                   i_att_content_hex    = binary_content.  "if you don;t have any content in this
"you will not get any attachment.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 11:24:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661273#M1096611</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T11:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661274#M1096612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what i add to my code is exactly  this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND 'Hello world!' TO lt_attach.
    document = cl_document_bcs=&amp;gt;create_document(
                    i_type    = 'RAW'
                    i_text    = lt_attach
                    i_length  = '12'
                    i_subject = 'test created by BCS_EXAMPLE_2' ).

    CALL METHOD document-&amp;gt;add_attachment
      EXPORTING
        i_attachment_type    = 'DOC'
        i_attachment_subject = 'My attachment'
        i_att_content_hex    = binary_content.

*     add document to send request
      CALL METHOD send_request-&amp;gt;set_document( document ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How i bring  content to binary_content ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. when i add the line :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD send_request-&amp;gt;set_document( document ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i still get the dump that i had before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 11:28:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661274#M1096612</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T11:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661275#M1096613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;show the complete code. the example working fine for me, i am getting the attachment also. but it is empty one. do one thing copy the code exacly and check. some where you are doing a mistake. &lt;/P&gt;&lt;P&gt;if you are not able to proceed show your code once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 11:32:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661275#M1096613</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T11:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661276#M1096614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vigay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report  YY_SEND_MAIL&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;*&amp;amp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  yy_send_mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS abap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lo_send_request TYPE REF TO cl_bcs,&lt;/P&gt;&lt;P&gt;      send_request       TYPE REF TO cl_bcs,&lt;/P&gt;&lt;P&gt;      lo_document      TYPE REF TO cl_document_bcs,&lt;/P&gt;&lt;P&gt;      lo_recipient     TYPE REF TO cl_cam_address_bcs,&lt;/P&gt;&lt;P&gt;      lo_exception     TYPE REF TO cx_bcs,&lt;/P&gt;&lt;P&gt;      lv_sent_to_all   TYPE os_boolean,&lt;/P&gt;&lt;P&gt;      lt_attach          TYPE soli_tab,       " Attachment content&lt;/P&gt;&lt;P&gt;      lt_flds        TYPE TABLE OF w3fields WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      document           TYPE REF TO cl_document_bcs,&lt;/P&gt;&lt;P&gt;      bcs_exception      TYPE REF TO cx_bcs,&lt;/P&gt;&lt;P&gt;      lv_error_txt       TYPE string,&lt;/P&gt;&lt;P&gt;      lt_header        TYPE TABLE OF w3head   WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      lt_html          TYPE TABLE OF w3html   WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      ls_tab_header    TYPE w3head.&lt;/P&gt;&lt;P&gt;DATA: binary_content     TYPE solix_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : lt_comp_tab    TYPE abap_component_tab WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;       tab_ref        TYPE REF TO data,&lt;/P&gt;&lt;P&gt;       line_ref       TYPE REF TO data,&lt;/P&gt;&lt;P&gt;       line_type      TYPE REF TO cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;       tab_type       TYPE REF TO cl_abap_tabledescr,&lt;/P&gt;&lt;P&gt;       data_describer TYPE REF TO cl_abap_datadescr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;table&amp;gt; TYPE table,&lt;/P&gt;&lt;P&gt;&amp;lt;line&amp;gt;  TYPE any,&amp;lt;field&amp;gt; TYPE any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS : table  TYPE tabname   DEFAULT 'HRP1001' ,&lt;/P&gt;&lt;P&gt;             fld1 TYPE fieldname DEFAULT 'OTYPE',&lt;/P&gt;&lt;P&gt;             fld2 TYPE fieldname  DEFAULT 'OBJID',&lt;/P&gt;&lt;P&gt;             mailto TYPE adr6-smtp_addr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;------For Dynmic Selection of table &amp;amp; fields -&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;    lt_comp_tab-name =  fld1.&lt;/P&gt;&lt;P&gt;    lt_comp_tab-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( field1 ).&lt;/P&gt;&lt;P&gt;    APPEND lt_comp_tab.&lt;/P&gt;&lt;P&gt;    lt_comp_tab-name =  fld2.&lt;/P&gt;&lt;P&gt;    lt_comp_tab-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( field2 ).&lt;/P&gt;&lt;P&gt;    APPEND lt_comp_tab.&lt;/P&gt;&lt;P&gt;  CATCH cx_sy_move_cast_error.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;    line_type ?= cl_abap_structdescr=&amp;gt;create( lt_comp_tab[] ).&lt;/P&gt;&lt;P&gt;    tab_type  ?= cl_abap_tabledescr=&amp;gt;create( line_type ).&lt;/P&gt;&lt;P&gt;  CATCH cx_sy_move_cast_error.&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA : tab_ref  TYPE HANDLE tab_type,&lt;/P&gt;&lt;P&gt;              line_ref TYPE HANDLE line_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN tab_ref-&amp;gt;*  TO &amp;lt;table&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN line_ref-&amp;gt;* TO &amp;lt;line&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--&lt;/STRONG&gt;&lt;DEL&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/DEL&gt;&lt;/P&gt;&lt;HR originaltext="----" /&gt;Select Data--&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform select_data_from_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE : 'Table Data' TO ls_tab_header-text,&lt;/P&gt;&lt;P&gt;            'Arial'      TO ls_tab_header-font,&lt;/P&gt;&lt;P&gt;             '2'          TO ls_tab_header-size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT lt_comp_tab.&lt;/P&gt;&lt;P&gt;  MOVE lt_comp_tab-name TO lt_header-text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MOVE : sy-tabix         TO lt_header-nr,&lt;/P&gt;&lt;P&gt;         'red'         TO lt_header-bg_color.&lt;/P&gt;&lt;P&gt;  APPEND lt_header.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'WWW_ITAB_TO_HTML'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    table_header = ls_tab_header&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    html         = lt_html[]&lt;/P&gt;&lt;P&gt;    fields       = lt_flds[]&lt;/P&gt;&lt;P&gt;    row_header   = lt_header[]&lt;/P&gt;&lt;P&gt;    itable       = &amp;lt;table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY.&lt;/P&gt;&lt;P&gt;    lo_send_request = cl_bcs=&amp;gt;create_persistent( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    lo_document = cl_document_bcs=&amp;gt;create_document( i_type    = 'HTM'&lt;/P&gt;&lt;P&gt;                                                    i_text    = lt_html[]&lt;/P&gt;&lt;P&gt;                                                    i_subject = 'Table' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND 'Hello world!' TO lt_attach.&lt;/P&gt;&lt;P&gt;    document = cl_document_bcs=&amp;gt;create_document(&lt;/P&gt;&lt;P&gt;                    i_type    = 'RAW'&lt;/P&gt;&lt;P&gt;                    i_text    = lt_attach&lt;/P&gt;&lt;P&gt;                    i_length  = '12'&lt;/P&gt;&lt;P&gt;                    i_subject = 'test created by BCS_EXAMPLE_2' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL METHOD document-&amp;gt;add_attachment&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        i_attachment_type    = 'DOC'&lt;/P&gt;&lt;P&gt;        i_attachment_subject = 'My attachment'&lt;/P&gt;&lt;P&gt;        i_att_content_hex    = binary_content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    add document to send request&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      CALL METHOD send_request-&amp;gt;set_document( document ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    lo_send_request-&amp;gt;set_document( lo_document ).&lt;/P&gt;&lt;P&gt;    lo_recipient = cl_cam_address_bcs=&amp;gt;create_internet_address( mailto ).&lt;/P&gt;&lt;P&gt;    lo_send_request-&amp;gt;add_recipient( EXPORTING i_recipient = lo_recipient&lt;/P&gt;&lt;P&gt;                                              i_express   = 'X' ).&lt;/P&gt;&lt;P&gt;    lo_send_request-&amp;gt;set_send_immediately( 'X' ).&lt;/P&gt;&lt;P&gt;    lv_sent_to_all = lo_send_request-&amp;gt;send( 'X' ).&lt;/P&gt;&lt;P&gt;    COMMIT WORK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 11:57:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661276#M1096614</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T11:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661277#M1096615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;"comment the below line 
"CALL METHOD send_request-&amp;gt;set_document( document ).  "since no object send_request
"in your example

lo_send_request-&amp;gt;set_document( lo_document ).
lo_recipient = cl_cam_address_bcs=&amp;gt;create_internet_address( mailto ).
lo_send_request-&amp;gt;add_recipient( EXPORTING i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request-&amp;gt;set_send_immediately( 'X' ).
lv_sent_to_all = lo_send_request-&amp;gt;send( 'X' ).
COMMIT WORK.

ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 12:11:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661277#M1096615</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T12:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661278#M1096616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay  ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i do that but still don't get the attchment,maybe u have other idea?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 12:24:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661278#M1096616</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T12:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661279#M1096617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ferry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are using two instances of classes &lt;/P&gt;&lt;P&gt;1) cl_document_bcs ( lo_document &amp;amp; document ) &amp;amp;&lt;/P&gt;&lt;P&gt;2) cl_bcs ( lo_send_request &amp;amp; send_request ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are getting the dump bcoz u r creating the instance &lt;STRONG&gt;lo_send_request&lt;/STRONG&gt; but using the instance &lt;STRONG&gt;send_request&lt;/STRONG&gt; !!!.&lt;/P&gt;&lt;P&gt;Same is being done with the instances of cl_document_bcs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use any one(only one) of the two instances...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the corrected code below, Here i have attached the same &lt;/P&gt;&lt;P&gt;html file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS abap.

DATA: lo_send_request TYPE REF TO cl_bcs,
send_request TYPE REF TO cl_bcs,
lo_document TYPE REF TO cl_document_bcs,
lo_recipient TYPE REF TO cl_cam_address_bcs,
lo_exception TYPE REF TO cx_bcs,
lv_sent_to_all TYPE os_boolean,
lt_attach TYPE soli_tab, " Attachment content
lt_flds TYPE TABLE OF w3fields WITH HEADER LINE,
document TYPE REF TO cl_document_bcs,
bcs_exception TYPE REF TO cx_bcs,
lv_error_txt TYPE string,
lt_header TYPE TABLE OF w3head WITH HEADER LINE,
lt_html TYPE TABLE OF w3html WITH HEADER LINE,
ls_tab_header TYPE w3head.
DATA: binary_content TYPE solix_tab.

DATA : lt_comp_tab TYPE abap_component_tab WITH HEADER LINE,
tab_ref TYPE REF TO data,
line_ref TYPE REF TO data,
line_type TYPE REF TO cl_abap_structdescr,
tab_type TYPE REF TO cl_abap_tabledescr,
data_describer TYPE REF TO cl_abap_datadescr.


FIELD-SYMBOLS : &amp;lt;table&amp;gt; TYPE table,
&amp;lt;line&amp;gt; TYPE ANY,&amp;lt;field&amp;gt; TYPE ANY.

PARAMETERS : table TYPE tabname DEFAULT 'HRP1001' ,
fld1 TYPE fieldname DEFAULT 'OTYPE',
fld2 TYPE fieldname DEFAULT 'OBJID',
mailto TYPE adr6-smtp_addr .

TRY.
    lt_comp_tab-name = fld1.
    lt_comp_tab-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( fld1 ).
    APPEND lt_comp_tab.
    lt_comp_tab-name = fld2.
    lt_comp_tab-type ?= cl_abap_datadescr=&amp;gt;describe_by_data( fld2 ).
    APPEND lt_comp_tab.
  CATCH cx_sy_move_cast_error.
    EXIT.
ENDTRY.

TRY.
    line_type ?= cl_abap_structdescr=&amp;gt;create( lt_comp_tab[] ).
    tab_type ?= cl_abap_tabledescr=&amp;gt;create( line_type ).
  CATCH cx_sy_move_cast_error.
ENDTRY.

CREATE DATA : tab_ref TYPE HANDLE tab_type,
line_ref TYPE HANDLE line_type.

ASSIGN tab_ref-&amp;gt;*  TO &amp;lt;table&amp;gt;.
ASSIGN line_ref-&amp;gt;* TO &amp;lt;line&amp;gt;.

SELECT * FROM (table) INTO CORRESPONDING FIELDS OF TABLE &amp;lt;table&amp;gt; UP TO 10 ROWS.

MOVE : 'Table Data' TO ls_tab_header-text,
       'Arial'      TO ls_tab_header-font,
       '2'          TO ls_tab_header-size.

LOOP AT lt_comp_tab.
  MOVE lt_comp_tab-name TO lt_header-text.
  MOVE : sy-tabix TO lt_header-nr,
         'red'    TO lt_header-bg_color.
  APPEND lt_header.
ENDLOOP.

CALL FUNCTION 'WWW_ITAB_TO_HTML'
  EXPORTING
    table_header = ls_tab_header
  TABLES
    html         = lt_html[]
    fields       = lt_flds[]
    row_header   = lt_header[]
    itable       = &amp;lt;table&amp;gt;.

TRY.
    lo_send_request = cl_bcs=&amp;gt;create_persistent( ).
    lo_document = cl_document_bcs=&amp;gt;create_document( i_type = 'HTM'
                                                    i_text = lt_html[]
                                                    i_subject = 'Table' ).
    lo_document-&amp;gt;add_attachment( i_attachment_type    = 'HTM'
                                 i_attachment_subject = 'My attachment'
                                 i_att_content_text   = lt_html[] ).
    lo_send_request-&amp;gt;set_document( lo_document ).
    lo_recipient = cl_cam_address_bcs=&amp;gt;create_internet_address( mailto ).
    lo_send_request-&amp;gt;add_recipient( EXPORTING i_recipient = lo_recipient
    i_express = 'X' ).
    lo_send_request-&amp;gt;set_send_immediately( 'X' ).
    lv_sent_to_all = lo_send_request-&amp;gt;send( 'X' ).
    COMMIT WORK.
  CATCH cx_bcs INTO bcs_exception.
ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 12:27:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661279#M1096617</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T12:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661280#M1096618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Jose, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks ! , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i copy your program to new i get the attachment &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt; , i try to find the diff now. &lt;/P&gt;&lt;P&gt;i don't understand way i don't get it because i remove the line of the code like Vijay says and i still don't get it in my code. &lt;/P&gt;&lt;P&gt;i get the attachment in HTM file maybe u can give example how can i get it with word/excel ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 12:41:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661280#M1096618</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T12:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661281#M1096619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i just looked for the line which caused the dump. the bcs example is very informative check it once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 12:53:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661281#M1096619</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T12:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661282#M1096620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Vijay, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks i do it now. &lt;/P&gt;&lt;P&gt;now i have other problem when i write words in the attachment i see it in the word document with space and with strange square between the words maybe u have idea ? &lt;/P&gt;&lt;P&gt;e.g. if i write Hello world i get just the word hello with square between the words.when i do copy paste it don't bring the square. &lt;/P&gt;&lt;P&gt;H  e l l o    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 13:04:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661282#M1096620</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T13:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add Attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661283#M1096621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that is binary format. if you have some word document you can send it. in otherway you can  try some thing like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: text_content       type soli_tab.
      append 'THis is attachemnt' to text_content.
      append 'THis is attachemnt' to text_content.
      append 'THis is attachemnt' to text_content

CALL METHOD document-&amp;gt;add_attachment
        EXPORTING  i_attachment_type = 'TXT'
                   i_attachment_subject = 'My attachment'
                   I_ATT_CONTENT_TEXT   = text_content.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Oct 2008 13:10:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/add-attachment/m-p/4661283#M1096621</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-28T13:10:50Z</dc:date>
    </item>
  </channel>
</rss>

