<?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: sending mail through abap program... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215070#M1007181</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;check this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/fu016.htm" target="test_blank"&gt;http://www.sap-img.com/fu016.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.thespot4sap.com/Articles/SAP_Mail_UNIX.asp" target="test_blank"&gt;http://www.thespot4sap.com/Articles/SAP_Mail_UNIX.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;prasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Jul 2008 09:22:55 GMT</pubDate>
    <dc:creator>prasanth_kasturi</dc:creator>
    <dc:date>2008-07-15T09:22:55Z</dc:date>
    <item>
      <title>sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215068#M1007179</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;&lt;/P&gt;&lt;P&gt;   I need a sample code to send a mail through ABAP code.&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;Ashu Singh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 09:12:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215068#M1007179</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T09:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215069#M1007180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Ashu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can use the FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Send the mail using the folloing mail to the above mentioned&lt;/P&gt;&lt;P&gt;*receivers&lt;/P&gt;&lt;P&gt;        call function &amp;lt;b&amp;gt; 'SO_NEW_DOCUMENT_SEND_API1'&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            document_data              = wa_document_data&lt;/P&gt;&lt;P&gt;            document_type              = 'RAW'&lt;/P&gt;&lt;P&gt;            put_in_outbox              = 'X'&lt;/P&gt;&lt;P&gt;            commit_work                = 'X'&lt;/P&gt;&lt;P&gt;          tables&lt;/P&gt;&lt;P&gt;            object_header              = it_object_header&lt;/P&gt;&lt;P&gt;            object_content             = it_object_content&lt;/P&gt;&lt;P&gt;            receivers                  = it_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;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help u &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 09:22:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215069#M1007180</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T09:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215070#M1007181</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;check this link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/fu016.htm" target="test_blank"&gt;http://www.sap-img.com/fu016.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.thespot4sap.com/Articles/SAP_Mail_UNIX.asp" target="test_blank"&gt;http://www.thespot4sap.com/Articles/SAP_Mail_UNIX.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;prasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 09:22:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215070#M1007181</guid>
      <dc:creator>prasanth_kasturi</dc:creator>
      <dc:date>2008-07-15T09:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215071#M1007182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hai Ashu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following call funciton is used for mail sending.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      document_data              = doc_chng&lt;/P&gt;&lt;P&gt;      put_in_outbox              = 'X'&lt;/P&gt;&lt;P&gt;      commit_work                = 'X'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      object_content             = objcont&lt;/P&gt;&lt;P&gt;      receivers                  = t_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;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Harish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2008 09:23:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215071#M1007182</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-15T09:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215072#M1007183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Here is a Sample Program to send mail through ABAP code....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the following sample program and also its easy to understand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zvenkat_mail_xls_attach.&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;P&gt;"  Data retrieval related declarations&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;P&gt;TYPES:&lt;/P&gt;&lt;P&gt;     BEGIN OF t_emp_dat,&lt;/P&gt;&lt;P&gt;       pernr TYPE pa0001-pernr,&lt;/P&gt;&lt;P&gt;       persg TYPE pa0001-persg,&lt;/P&gt;&lt;P&gt;       persk TYPE pa0001-persk,&lt;/P&gt;&lt;P&gt;       plans TYPE pa0001-plans,&lt;/P&gt;&lt;P&gt;       stell TYPE pa0001-stell,&lt;/P&gt;&lt;P&gt;     END OF t_emp_dat.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;     w_emp_data TYPE t_emp_dat.&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;     i_emp_data TYPE STANDARD TABLE OF t_emp_dat.&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;P&gt;"  Mail related declarations&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;P&gt;"Variables&lt;/P&gt;&lt;P&gt;DATA :&lt;/P&gt;&lt;P&gt;     g_sent_to_all   TYPE sonv-flag,&lt;/P&gt;&lt;P&gt;     g_tab_lines     TYPE i.&lt;/P&gt;&lt;P&gt;"Types&lt;/P&gt;&lt;P&gt;TYPES:&lt;/P&gt;&lt;P&gt;     t_document_data  TYPE  sodocchgi1,&lt;/P&gt;&lt;P&gt;     t_packing_list   TYPE  sopcklsti1,&lt;/P&gt;&lt;P&gt;     t_attachment     TYPE  solisti1,&lt;/P&gt;&lt;P&gt;     t_body_msg       TYPE  solisti1,&lt;/P&gt;&lt;P&gt;     t_receivers      TYPE  somlreci1.&lt;/P&gt;&lt;P&gt;"Workareas&lt;/P&gt;&lt;P&gt;DATA :&lt;/P&gt;&lt;P&gt;     w_document_data  TYPE  t_document_data,&lt;/P&gt;&lt;P&gt;     w_packing_list   TYPE  t_packing_list,&lt;/P&gt;&lt;P&gt;     w_attachment     TYPE  t_attachment,&lt;/P&gt;&lt;P&gt;     w_body_msg       TYPE  t_body_msg,&lt;/P&gt;&lt;P&gt;     w_receivers      TYPE  t_receivers.&lt;/P&gt;&lt;P&gt;"Internal Tables&lt;/P&gt;&lt;P&gt;DATA :&lt;/P&gt;&lt;P&gt;     i_document_data  TYPE STANDARD TABLE OF t_document_data,&lt;/P&gt;&lt;P&gt;     i_packing_list   TYPE STANDARD TABLE OF t_packing_list,&lt;/P&gt;&lt;P&gt;     i_attachment     TYPE STANDARD TABLE OF t_attachment,&lt;/P&gt;&lt;P&gt;     i_body_msg       TYPE STANDARD TABLE OF t_body_msg,&lt;/P&gt;&lt;P&gt;     i_receivers      TYPE STANDARD TABLE OF t_receivers.&lt;/P&gt;&lt;P&gt; &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;P&gt;"Start-of-selection.&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;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  PERFORM get_data.&lt;/P&gt;&lt;P&gt;  PERFORM build_xls_data_table.&lt;/P&gt;&lt;P&gt; &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;P&gt;  "End-of-selection.&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;P&gt;END-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  PERFORM send_mail.&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;  "Form  get_data from PA0001&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 get_data.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  SELECT pernr&lt;/P&gt;&lt;P&gt;         persg&lt;/P&gt;&lt;P&gt;         persk&lt;/P&gt;&lt;P&gt;         plans&lt;/P&gt;&lt;P&gt;         stell&lt;/P&gt;&lt;P&gt;   FROM pa0001&lt;/P&gt;&lt;P&gt;   INTO CORRESPONDING FIELDS OF TABLE i_emp_data&lt;/P&gt;&lt;P&gt;   UP TO 4 ROWS.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDFORM.                    " get_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  build_xls_data_table&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 build_xls_data_table.&lt;/P&gt;&lt;P&gt;  "If you have Unicode check active in program attributes then&lt;/P&gt;&lt;P&gt;  "you will need to declare constants as follows.&lt;/P&gt;&lt;P&gt;  CLASS cl_abap_char_utilities DEFINITION LOAD.&lt;/P&gt;&lt;P&gt;  CONSTANTS:&lt;/P&gt;&lt;P&gt;      con_tab  TYPE c VALUE cl_abap_char_utilities=&amp;gt;horizontal_tab,&lt;/P&gt;&lt;P&gt;      con_cret TYPE c VALUE cl_abap_char_utilities=&amp;gt;cr_lf.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CONCATENATE 'PERNR' 'PERSG' 'PERSK' 'PLANS' 'STELL'&lt;/P&gt;&lt;P&gt;         INTO  w_attachment&lt;/P&gt;&lt;P&gt; SEPARATED BY  con_tab.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CONCATENATE con_cret&lt;/P&gt;&lt;P&gt;              w_attachment&lt;/P&gt;&lt;P&gt;         INTO w_attachment.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  APPEND w_attachment TO i_attachment.&lt;/P&gt;&lt;P&gt;  CLEAR  w_attachment.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  LOOP AT i_emp_data INTO w_emp_data.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    CONCATENATE w_emp_data-pernr&lt;/P&gt;&lt;P&gt;                w_emp_data-persg&lt;/P&gt;&lt;P&gt;                w_emp_data-persk&lt;/P&gt;&lt;P&gt;                w_emp_data-plans&lt;/P&gt;&lt;P&gt;                w_emp_data-stell&lt;/P&gt;&lt;P&gt;           INTO w_attachment&lt;/P&gt;&lt;P&gt;   SEPARATED BY con_tab.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    CONCATENATE con_cret w_attachment&lt;/P&gt;&lt;P&gt;           INTO w_attachment.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    APPEND w_attachment TO i_attachment.&lt;/P&gt;&lt;P&gt;    CLEAR  w_attachment.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDFORM.                    "build_xls_data_table&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  send_mail&lt;/P&gt;&lt;P&gt;"----&lt;/P&gt;&lt;HR originaltext="----------" /&gt;&lt;P&gt;"PACKING LIST&lt;/P&gt;&lt;P&gt;"This table requires information about how the data in the&lt;/P&gt;&lt;P&gt;"tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are to&lt;/P&gt;&lt;P&gt;"be distributed to the documents and its attachments.The first&lt;/P&gt;&lt;P&gt;"row is for the document, the following rows are each for one&lt;/P&gt;&lt;P&gt;"attachment.&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 send_mail .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  "Subject of the mail.&lt;/P&gt;&lt;P&gt;  w_document_data-obj_name  = 'MAIL_TO_HEAD'.&lt;/P&gt;&lt;P&gt;  w_document_data-obj_descr = 'Regarding Mail Program by SAP ABAP'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  "Body of the mail&lt;/P&gt;&lt;P&gt;  PERFORM build_body_of_mail&lt;/P&gt;&lt;P&gt;    USING:space,&lt;/P&gt;&lt;P&gt;          'Hi,',&lt;/P&gt;&lt;P&gt;          'I am fine. How are you? How are you doing ? ',&lt;/P&gt;&lt;P&gt;          'This program has been created to send simple mail',&lt;/P&gt;&lt;P&gt;          'with Subject,Body with Address of the sender. ',&lt;/P&gt;&lt;P&gt;          'Regards,',&lt;/P&gt;&lt;P&gt;          'Venkat.O,',&lt;/P&gt;&lt;P&gt;          'SAP HR Technical Consultant.'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  "Write Packing List for Body&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE i_body_msg LINES g_tab_lines.&lt;/P&gt;&lt;P&gt;  w_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  w_packing_list-head_num   = 0.&lt;/P&gt;&lt;P&gt;  w_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;  w_packing_list-body_num   = g_tab_lines.&lt;/P&gt;&lt;P&gt;  w_packing_list-doc_type   = 'RAW'.&lt;/P&gt;&lt;P&gt;  APPEND w_packing_list TO i_packing_list.&lt;/P&gt;&lt;P&gt;  CLEAR  w_packing_list.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  "Write Packing List for Attachment&lt;/P&gt;&lt;P&gt;  w_packing_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;  w_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  w_packing_list-head_num   = 1.&lt;/P&gt;&lt;P&gt;  w_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.&lt;/P&gt;&lt;P&gt;  w_packing_list-doc_type   = 'XLS'.&lt;/P&gt;&lt;P&gt;  w_packing_list-obj_descr  = 'Excell Attachment'.&lt;/P&gt;&lt;P&gt;  w_packing_list-obj_name   = 'XLS_ATTACHMENT'.&lt;/P&gt;&lt;P&gt;  w_packing_list-doc_size   = w_packing_list-body_num * 255.&lt;/P&gt;&lt;P&gt;  APPEND w_packing_list TO i_packing_list.&lt;/P&gt;&lt;P&gt;  CLEAR  w_packing_list.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  "Fill the document data and get size of attachment&lt;/P&gt;&lt;P&gt;  w_document_data-obj_langu  = sy-langu.&lt;/P&gt;&lt;P&gt;  READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.&lt;/P&gt;&lt;P&gt;  w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN(&lt;/P&gt;&lt;P&gt;w_attachment ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  "Receivers List.&lt;/P&gt;&lt;P&gt;  w_receivers-rec_type   = 'U'.  "Internet address&lt;/P&gt;&lt;P&gt;  w_receivers-receiver   = 'mail id'.&lt;/P&gt;&lt;P&gt;  w_receivers-com_type   = 'INT'.&lt;/P&gt;&lt;P&gt;  w_receivers-notif_del  = 'X'.&lt;/P&gt;&lt;P&gt;  w_receivers-notif_ndel = 'X'.&lt;/P&gt;&lt;P&gt;  APPEND w_receivers TO i_receivers .&lt;/P&gt;&lt;P&gt;  CLEAR:w_receivers.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  "Function module to send mail to Recipients&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              = w_document_data&lt;/P&gt;&lt;P&gt;      put_in_outbox              = 'X'&lt;/P&gt;&lt;P&gt;      commit_work                = 'X'&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      sent_to_all                = g_sent_to_all&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      packing_list               = i_packing_list&lt;/P&gt;&lt;P&gt;      contents_bin               = i_attachment&lt;/P&gt;&lt;P&gt;      contents_txt               = i_body_msg&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;  IF sy-subrc = 0 .&lt;/P&gt;&lt;P&gt;    MESSAGE i303(me) WITH 'Mail has been Successfully Sent.'.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    WAIT UP TO 2 SECONDS.&lt;/P&gt;&lt;P&gt;    "This program starts the SAPconnect send process.&lt;/P&gt;&lt;P&gt;    SUBMIT rsconn01 WITH mode = 'INT'&lt;/P&gt;&lt;P&gt;                 WITH output = 'X'&lt;/P&gt;&lt;P&gt;                 AND RETURN.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ENDFORM.                    " send_mail&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  build_body_of_mail&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 build_body_of_mail  USING l_message.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  w_body_msg = l_message.&lt;/P&gt;&lt;P&gt;  APPEND w_body_msg TO i_body_msg.&lt;/P&gt;&lt;P&gt;  CLEAR  w_body_msg.&lt;/P&gt;&lt;P&gt;ENDFORM.                    " build_body_of_mail&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2008 08:52:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215072#M1007183</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-17T08:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215073#M1007184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: OBJPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
  DATA: OBJHEAD   LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
  DATA: OBJBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
  DATA: OBJTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
  DATA: RECLIST   LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
  DATA: DOC_CHNG  LIKE SODOCCHGI1.
  DATA: TAB_LINES LIKE SY-TABIX.
  DATA L_NUM(3).


* Creation of the document to be sent
* File Name
  DOC_CHNG-OBJ_NAME = 'SENDFILE'.
* Mail Subject
  DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.
* Mail Contents
  OBJTXT = 'Object text'.
  APPEND OBJTXT.

  DESCRIBE TABLE OBJTXT LINES TAB_LINES.
  READ TABLE OBJTXT INDEX TAB_LINES.
  DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
* Creation of the entry for the compressed document
  CLEAR OBJPACK-TRANSF_BIN.
  OBJPACK-HEAD_START = 1.
  OBJPACK-HEAD_NUM = 0.
  OBJPACK-BODY_START = 1.
  OBJPACK-BODY_NUM = TAB_LINES.
  OBJPACK-DOC_TYPE = 'RAW'.
  APPEND OBJPACK.

* Creation of the document attachment
  LOOP AT ITAB_DATA.
    CONCATENATE ITAB_DATA-PRODUCTOR
                ITAB_DATA-VBELN
                ITAB_DATA-POSNR
                ITAB_DATA-MATNR INTO OBJBIN.
    APPEND OBJBIN.

  ENDLOOP.

  DESCRIBE TABLE OBJBIN LINES TAB_LINES.
  OBJHEAD = 'ORDERS'.
  APPEND OBJHEAD.

** Creation of the entry for the compressed attachment
  OBJPACK-TRANSF_BIN = 'X'.
  OBJPACK-HEAD_START = 1.
  OBJPACK-HEAD_NUM   = 1.
  OBJPACK-BODY_START = 1.
  OBJPACK-BODY_NUM   = TAB_LINES.
  OBJPACK-DOC_TYPE   = 'TXT'.
  OBJPACK-OBJ_NAME   = 'WEBSITE'.
  OBJPACK-OBJ_DESCR  = 'ORDERS.TXT'.
  OBJPACK-DOC_SIZE   = TAB_LINES * 255.
  APPEND OBJPACK.

* Completing the recipient list
* target recipent
  clear RECLIST.
  RECLIST-RECEIVER = ' Enter Email ID'.
  RECLIST-EXPRESS  = 'X'.
  RECLIST-REC_TYPE = 'U'.
  APPEND RECLIST.
* copy recipents
  clear RECLIST.
  
* Sending the document
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
       EXPORTING
            DOCUMENT_DATA              = DOC_CHNG
       TABLES
            PACKING_LIST               = OBJPACK
            OBJECT_HEADER              = OBJHEAD
            CONTENTS_BIN               = OBJBIN
            CONTENTS_TXT               = OBJTXT
            RECEIVERS                  = RECLIST
       EXCEPTIONS
            TOO_MANY_RECEIVERS         = 1
            DOCUMENT_NOT_SENT          = 2
            OPERATION_NO_AUTHORIZATION = 4
            OTHERS                     = 99.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2008 09:31:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215073#M1007184</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-17T09:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215074#M1007185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even after using the API 's on the above posts, still you are not able to send amil, ensure that user settings in SU01 for your user is properly set so that you can send the mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also goto the transaction SCOT to see whether the corresponding job is executed or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ragha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2008 09:32:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215074#M1007185</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-17T09:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215075#M1007186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even after using the API 's on the above posts, still you are not able to send amil, ensure that user settings in SU01 for your user is properly set so that you can send the mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also goto the transaction SCOT to see whether the corresponding job is executed or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ragha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2008 09:39:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215075#M1007186</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-17T09:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: sending mail through abap program...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215076#M1007187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Code Links&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sapr3.tripod.com/abap011.htm" target="test_blank"&gt;http://sapr3.tripod.com/abap011.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.saptechies.com/some-examples-of-the-use-of-so_new_document_send_api1/" target="test_blank"&gt;http://www.saptechies.com/some-examples-of-the-use-of-so_new_document_send_api1/&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2008 11:08:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sending-mail-through-abap-program/m-p/4215076#M1007187</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-17T11:08:19Z</dc:date>
    </item>
  </channel>
</rss>

