<?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: mail attachment in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/4621434#M1088633</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you used the search option ..?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="thread" id="517888"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="thread" id="417561"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Oct 2008 10:31:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-12T10:31:08Z</dc:date>
    <item>
      <title>mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/4621433#M1088632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;could u pls answer my thread...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want the class name for sending 2 mail attachment at a time.........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&amp;amp;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rahul........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2008 10:15:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/4621433#M1088632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-12T10:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/4621434#M1088633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you used the search option ..?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="thread" id="517888"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="thread" id="417561"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2008 10:31:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/4621434#M1088633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-12T10:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/4621435#M1088634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rahul,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As mentioned in the above thread, BCS Classes are &lt;/P&gt;&lt;P&gt;used for this purpose...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To achieve this, we have to create a document (instance of &lt;/P&gt;&lt;P&gt;cl_document_bcs) and link it to the mailer object (instance of &lt;/P&gt;&lt;P&gt;cl_bcs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The class cl_document_bcs has a method add_attachment.&lt;/P&gt;&lt;P&gt;We can use this to add attachments (more than one).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the sample code below where I have attached a text file &lt;/P&gt;&lt;P&gt;twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also there are many std demo programs starting with &lt;STRONG&gt;BCS_&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: send_request       TYPE REF TO cl_bcs,
      lt_text            TYPE bcsy_text,      " Message body
      lt_attach          TYPE soli_tab,       " Attachment content
      document           TYPE REF TO cl_document_bcs,
      recipient          TYPE REF TO cl_cam_address_bcs,
      bcs_exception      TYPE REF TO cx_bcs,
      lv_error_txt       TYPE string,
      sent_to_all        TYPE os_boolean.

PARAMETERS p_mailid TYPE adr6-smtp_addr.

TRY.

    send_request = cl_bcs=&amp;gt;create_persistent( ).

    APPEND 'Test message' TO lt_text.

    document = cl_document_bcs=&amp;gt;create_document( i_type    = 'RAW'
                                                 i_text    = lt_text
                                                 i_subject = 'Check this' ).
    APPEND 'Test Attachment' TO lt_attach.

    document-&amp;gt;add_attachment( EXPORTING i_attachment_type    = 'RAW'    " First Attachment
                                        i_attachment_subject = 'attach1.txt'
                                        i_att_content_text   = lt_attach ).

    document-&amp;gt;add_attachment( EXPORTING i_attachment_type    = 'RAW'    " Second Attachment(same docu)
                                        i_attachment_subject = 'attach2.txt'
                                        i_att_content_text   = lt_attach ).

    send_request-&amp;gt;set_document( document ).

    recipient = cl_cam_address_bcs=&amp;gt;create_internet_address( p_mailid ).

    send_request-&amp;gt;add_recipient( EXPORTING i_recipient = recipient
                                           i_express   = 'X' ).

    sent_to_all = send_request-&amp;gt;send( i_with_error_screen = 'X' ).

    COMMIT WORK.
  CATCH cx_bcs INTO bcs_exception.
    lv_error_txt = bcs_exception-&amp;gt;get_text( ).
    WRITE:`Error : ` , lv_error_txt.
    EXIT.

ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Issued mails can be checked in tcode SOST&lt;/P&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>Mon, 13 Oct 2008 06:58:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mail-attachment/m-p/4621435#M1088634</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-13T06:58:08Z</dc:date>
    </item>
  </channel>
</rss>

