<?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: Regarding Mail Send in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125397#M446136</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use this Fm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO_NEW_DOCUMENT_ATT_SEND_API1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Apr 2007 13:29:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-19T13:29:28Z</dc:date>
    <item>
      <title>Regarding Mail Send</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125395#M446134</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 want to send an email with out attachments through internet from SAP using ABAP code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz give me the code and any configurations and settings (steps) asap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;venkat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 13:25:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125395#M446134</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T13:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding Mail Send</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125396#M446135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do the configurations in SCOT transaction  first.&lt;/P&gt;&lt;P&gt;see the sample code:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INCLUDE ZINCUSMAIL                                                 *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;include &amp;lt;symbol&amp;gt;.&lt;/P&gt;&lt;P&gt;data : i_doc_data like sodocchgi1.&lt;/P&gt;&lt;P&gt;data : begin of i_pack_list occurs 0.&lt;/P&gt;&lt;P&gt;        include structure sopcklsti1.&lt;/P&gt;&lt;P&gt;data : end of i_pack_list.&lt;/P&gt;&lt;P&gt;data : begin of i_receivers occurs 0.&lt;/P&gt;&lt;P&gt;        include structure somlreci1.&lt;/P&gt;&lt;P&gt;data : end of i_receivers.&lt;/P&gt;&lt;P&gt;data : begin of i_contents occurs 0.&lt;/P&gt;&lt;P&gt;        include structure solisti1.&lt;/P&gt;&lt;P&gt;data : end of i_contents.&lt;/P&gt;&lt;P&gt;data : begin of i_header occurs 0.&lt;/P&gt;&lt;P&gt;        include structure solisti1.&lt;/P&gt;&lt;P&gt;data : end of i_header.&lt;/P&gt;&lt;P&gt;data : begin of i_att occurs 0.&lt;/P&gt;&lt;P&gt;        include structure solisti1.&lt;/P&gt;&lt;P&gt;data : end of i_att.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for Internet address.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of it_inad occurs 0,&lt;/P&gt;&lt;P&gt;        kunnr like kna1-kunnr,           " Customer Code&lt;/P&gt;&lt;P&gt;        name1 like kna1-name1,           " Customer Name&lt;/P&gt;&lt;P&gt;        ssobl like knkk-ssobl,           " Security Deposit&lt;/P&gt;&lt;P&gt;        klimk like knkk-klimk,           " Credit Limit&lt;/P&gt;&lt;P&gt;        opbal like bsid-wrbtr,           " Opening Balance&lt;/P&gt;&lt;P&gt;        clbal like bsid-wrbtr,           " Closing Balance&lt;/P&gt;&lt;P&gt;        smtp  like adr6-smtp_addr,       " Internet mail (SMTP) address&lt;/P&gt;&lt;P&gt;      end of it_inad.&lt;/P&gt;&lt;P&gt;data : pdf_line(134),&lt;/P&gt;&lt;P&gt;       asdf like pdf_line occurs 0 with header line.&lt;/P&gt;&lt;P&gt;data : pdf_table like tline occurs 0 with header line,&lt;/P&gt;&lt;P&gt;       pdf_fsize type  i.&lt;/P&gt;&lt;P&gt;data : stuff(65000),&lt;/P&gt;&lt;P&gt;       len type i,&lt;/P&gt;&lt;P&gt;       pos type i,&lt;/P&gt;&lt;P&gt;       tab_lines like sy-tabix.&lt;/P&gt;&lt;P&gt;data:  spoolid    type tsp01-rqident,&lt;/P&gt;&lt;P&gt;       spdel      type tsp01sys.&lt;/P&gt;&lt;P&gt;data:  v_gjahrt like bsid-gjahr,&lt;/P&gt;&lt;P&gt;       fmondest(10),&lt;/P&gt;&lt;P&gt;       tmondest(10),&lt;/P&gt;&lt;P&gt;       kunnr1 like kna1-kunnr,&lt;/P&gt;&lt;P&gt;       gjah(4),&lt;/P&gt;&lt;P&gt;       fmon(10).&lt;/P&gt;&lt;P&gt;&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;      Form  hide_write&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;form hide_write.&lt;/P&gt;&lt;P&gt;  new-page print on&lt;/P&gt;&lt;P&gt;    line-size 160&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   line-count 58&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    no-title&lt;/P&gt;&lt;P&gt;    no-heading&lt;/P&gt;&lt;P&gt;    destination 'LOCL'&lt;/P&gt;&lt;P&gt;    immediately ' '&lt;/P&gt;&lt;P&gt;    new list identification 'X'&lt;/P&gt;&lt;P&gt;    no dialog.&lt;/P&gt;&lt;P&gt;  set blank lines on.&lt;/P&gt;&lt;P&gt;endform.                    " hide_write&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;      Form  end_write&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;form end_write using kunnr1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  set blank lines off.&lt;/P&gt;&lt;P&gt;  new-page print off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***Using Spoolid we are getting PDF formated file&lt;/P&gt;&lt;P&gt;  spoolid = spdel-rqident = sy-spono.&lt;/P&gt;&lt;P&gt;  spdel-sys = sy-sysid.&lt;/P&gt;&lt;P&gt;  call function 'CONVERT_ABAPSPOOLJOB_2_PDF'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            src_spoolid   = spoolid&lt;/P&gt;&lt;P&gt;            no_dialog     = 'X'&lt;/P&gt;&lt;P&gt;       importing&lt;/P&gt;&lt;P&gt;            pdf_bytecount = pdf_fsize&lt;/P&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;            pdf           = pdf_table&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            others        = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***Delleting Spool request&lt;/P&gt;&lt;P&gt;  call function 'RSPO_IDELETE_SPOOLREQ'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            spoolreq = spdel&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            others   = 2.&lt;/P&gt;&lt;P&gt;***Converting PDF table line size 134 into standard list size 255&lt;/P&gt;&lt;P&gt;  loop at pdf_table into pdf_line.&lt;/P&gt;&lt;P&gt;    if pos = 34170.&lt;/P&gt;&lt;P&gt;     perform attach.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    stuff+pos(134) = pdf_line.&lt;/P&gt;&lt;P&gt;    add 134 to pos.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;if not ( stuff is initial ).&lt;/P&gt;&lt;P&gt;  perform attach.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;clear pdf_line.&lt;/P&gt;&lt;P&gt;clear pdf_table[].&lt;/P&gt;&lt;P&gt;describe table i_att lines tab_lines.&lt;/P&gt;&lt;P&gt;i_pack_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;i_pack_list-head_start = '1'.&lt;/P&gt;&lt;P&gt;i_pack_list-head_num = '1'.&lt;/P&gt;&lt;P&gt;i_pack_list-body_start = '1'.&lt;/P&gt;&lt;P&gt;i_pack_list-body_num = tab_lines.&lt;/P&gt;&lt;P&gt;i_pack_list-doc_type = 'PDF'.&lt;/P&gt;&lt;P&gt;i_pack_list-obj_name = 'LedgerMail'.&lt;/P&gt;&lt;P&gt;concatenate fmon '-' gjah into i_pack_list-obj_descr.&lt;/P&gt;&lt;P&gt;*i_pack_list-obj_descr = '2092-Oct03'.&lt;/P&gt;&lt;P&gt;i_pack_list-obj_langu = 'E'.&lt;/P&gt;&lt;P&gt;i_pack_list-doc_size = tab_lines * 255.&lt;/P&gt;&lt;P&gt;append i_pack_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***Data for receivers list&lt;/P&gt;&lt;P&gt;loop at it_inad where kunnr eq kunnr1.&lt;/P&gt;&lt;P&gt;i_receivers-receiver = it_inad-smtp.&lt;/P&gt;&lt;P&gt;i_receivers-rec_type = 'U'.&lt;/P&gt;&lt;P&gt;i_receivers-rec_date = sy-datum.&lt;/P&gt;&lt;P&gt;i_receivers-express = 'X'.&lt;/P&gt;&lt;P&gt;i_receivers-com_type = 'INT'.&lt;/P&gt;&lt;P&gt;i_receivers-notif_del = 'X'.&lt;/P&gt;&lt;P&gt;append i_receivers.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;    document_data                    = i_doc_data&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  PUT_IN_OUTBOX                    = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  SENT_TO_ALL                      =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NEW_OBJECT_ID                    =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  tables&lt;/P&gt;&lt;P&gt;    packing_list                     = i_pack_list&lt;/P&gt;&lt;P&gt;    object_header                    = i_header&lt;/P&gt;&lt;P&gt;    contents_bin                     = i_att&lt;/P&gt;&lt;P&gt;    contents_txt                     = i_contents&lt;/P&gt;&lt;P&gt;    receivers                        = i_receivers&lt;/P&gt;&lt;P&gt; exceptions&lt;/P&gt;&lt;P&gt;   too_many_receivers               = 1&lt;/P&gt;&lt;P&gt;   document_not_sent                = 2&lt;/P&gt;&lt;P&gt;   document_type_not_exist          = 3&lt;/P&gt;&lt;P&gt;   operation_no_authorization       = 4&lt;/P&gt;&lt;P&gt;   parameter_error                  = 5&lt;/P&gt;&lt;P&gt;   x_error                          = 6&lt;/P&gt;&lt;P&gt;   enqueue_error                    = 7&lt;/P&gt;&lt;P&gt;   others                           = 8&lt;/P&gt;&lt;P&gt;          .&lt;/P&gt;&lt;P&gt;refresh i_att. clear i_att.&lt;/P&gt;&lt;P&gt;refresh i_receivers. clear i_receivers.&lt;/P&gt;&lt;P&gt;delete i_pack_list where doc_type = 'PDF'.&lt;/P&gt;&lt;P&gt;*refresh i_header.&lt;/P&gt;&lt;P&gt;*refresh i_contents.&lt;/P&gt;&lt;P&gt;*clear i_doc_data.&lt;/P&gt;&lt;P&gt;endform.                    " end_write&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;      Form  doc_data&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;form doc_data using fmondest v_gjahrt.&lt;/P&gt;&lt;P&gt;gjah = v_gjahrt.&lt;/P&gt;&lt;P&gt;fmon = fmondest.&lt;/P&gt;&lt;P&gt;***Data for Document Data&lt;/P&gt;&lt;P&gt;i_doc_data-obj_name = 'LedgerMail'.&lt;/P&gt;&lt;P&gt;concatenate 'Customer Ledger for : ' fmondest gjah&lt;/P&gt;&lt;P&gt;into i_doc_data-obj_descr separated by space.&lt;/P&gt;&lt;P&gt;i_doc_data-obj_langu = 'E'.&lt;/P&gt;&lt;P&gt;i_doc_data-obj_prio = '1'.&lt;/P&gt;&lt;P&gt;i_doc_data-no_change = 'X'.&lt;/P&gt;&lt;P&gt;i_doc_data-doc_size = '5101'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***Data for Packing list&lt;/P&gt;&lt;P&gt;i_pack_list-head_start = '1'.&lt;/P&gt;&lt;P&gt;i_pack_list-head_num = '1'.&lt;/P&gt;&lt;P&gt;i_pack_list-body_start = '1'.&lt;/P&gt;&lt;P&gt;i_pack_list-body_num = '20'.&lt;/P&gt;&lt;P&gt;i_pack_list-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;i_pack_list-obj_langu = 'E'.&lt;/P&gt;&lt;P&gt;append i_pack_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***Data for Header&lt;/P&gt;&lt;P&gt;i_header-line = 'Header'. append i_header.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***Data for contents&lt;/P&gt;&lt;P&gt;i_contents-line = 'Dear Customer,'. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;concatenate 'Please find your enclosed Ledger for the month of : '&lt;/P&gt;&lt;P&gt;fmondest gjah into i_contents-line separated by space.&lt;/P&gt;&lt;P&gt;append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = 'This is a computer generated document and does not&lt;/P&gt;&lt;P&gt;require a signature.'. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = 'Note : If you do not have Acrobat Reader please click&lt;/P&gt;&lt;P&gt; on the below link.'. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = 'http://www.adobe.com/products/acrobat/readstep2.html'&lt;/P&gt;&lt;P&gt;. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;i_contents-line = ' '. append i_contents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " doc_data&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;      Form  attach&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;form attach.&lt;/P&gt;&lt;P&gt;  clear pos.&lt;/P&gt;&lt;P&gt;  len = strlen( stuff ).&lt;/P&gt;&lt;P&gt;  while len &amp;gt; 0.&lt;/P&gt;&lt;P&gt;    subtract 255 from len.&lt;/P&gt;&lt;P&gt;    i_att = stuff+pos(255).&lt;/P&gt;&lt;P&gt;    append i_att.&lt;/P&gt;&lt;P&gt;    add 255 to pos.&lt;/P&gt;&lt;P&gt;  endwhile.&lt;/P&gt;&lt;P&gt;  clear pos.&lt;/P&gt;&lt;P&gt;  clear stuff.&lt;/P&gt;&lt;P&gt;endform.                    " attach&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this for ur info&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="304909"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;to send mail&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html" target="test_blank"&gt;http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if useful&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 13:29:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125396#M446135</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T13:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding Mail Send</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125397#M446136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Use this Fm&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO_NEW_DOCUMENT_ATT_SEND_API1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 13:29:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125397#M446136</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T13:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding Mail Send</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125398#M446137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Here is the Sample Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZSENDEMAIL                                                  *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Example of sending external email via SAPCONNECT                    *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
REPORT  zsendemail                    .

PARAMETERS: psubject(40) type c default  'Hello',
            p_email(40)   type c default 'test@sapdev.co.uk' .

data:   it_packing_list like sopcklsti1 occurs 0 with header line,
        it_contents like solisti1 occurs 0 with header line,
        it_receivers like somlreci1 occurs 0 with header line,
        it_attachment like solisti1 occurs 0 with header line,
        gd_cnt type i,
        gd_sent_all(1) type c,
        gd_doc_data like sodocchgi1,
        gd_error type sy-subrc.

data:   it_message type standard table of SOLISTI1 initial size 0
                with header line.

***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

Perform populate_message_table.

*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.

*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  POPULATE_MESSAGE_TABLE
*&amp;amp;---------------------------------------------------------------------*
*       Adds text to email text table
*----------------------------------------------------------------------*
form populate_message_table.
  Append 'Email line 1' to it_message.
  Append 'Email line 2' to it_message.
  Append 'Email line 3' to it_message.
  Append 'Email line 4' to it_message.
endform.                    " POPULATE_MESSAGE_TABLE


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SEND_EMAIL_MESSAGE
*&amp;amp;---------------------------------------------------------------------*
*       Send email message
*----------------------------------------------------------------------*
form send_email_message.
* Fill the document data.
  gd_doc_data-doc_size = 1.

* Populate the subject/generic message attributes
  gd_doc_data-obj_langu = sy-langu.
  gd_doc_data-obj_name  = 'SAPRPT'.
  gd_doc_data-obj_descr = psubject.
  gd_doc_data-sensitivty = 'F'.

* Describe the body of the message
  clear it_packing_list.
  refresh it_packing_list.
  it_packing_list-transf_bin = space.
  it_packing_list-head_start = 1.
  it_packing_list-head_num = 0.
  it_packing_list-body_start = 1.
  describe table it_message lines it_packing_list-body_num.
  it_packing_list-doc_type = 'RAW'.
  append it_packing_list.

* Add the recipients email address
  clear it_receivers.
  refresh it_receivers.
  it_receivers-receiver = p_email.
  it_receivers-rec_type = 'U'.
  it_receivers-com_type = 'INT'.
  it_receivers-notif_del = 'X'.
  it_receivers-notif_ndel = 'X'.
  append it_receivers.

* Call the FM to post the message to SAPMAIL
  call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
       exporting
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
       importing
            sent_to_all                = gd_sent_all
       tables
            packing_list               = it_packing_list
            contents_txt               = it_message
            receivers                  = it_receivers
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            others                     = 8.

* Store function module return code
  gd_error = sy-subrc.

* Get it_receivers return code
  loop at it_receivers.
  endloop.
endform.                    " SEND_EMAIL_MESSAGE


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  INITIATE_MAIL_EXECUTE_PROGRAM
*&amp;amp;---------------------------------------------------------------------*
*       Instructs mail send program for SAPCONNECT to send email.
*----------------------------------------------------------------------*
form initiate_mail_execute_program.
  wait up to 2 seconds.
  if gd_error eq 0.
      submit rsconn01 with mode = 'INT'
                    with output = 'X'
                    and return.
  endif.
endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM&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; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2007 13:30:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-mail-send/m-p/2125398#M446137</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-19T13:30:16Z</dc:date>
    </item>
  </channel>
</rss>

