<?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 Function Module for Excel and Email in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617741#M276492</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to write some ABAP routine in BW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the scenario:&lt;/P&gt;&lt;P&gt;Reading records from request packet, storing it in some internal table, and then by calling some FM to store in Excel Sheet, and then sending that excel sheet on external mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whats the Function Modules for saving the output into excel format and sending the file using email?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Sep 2006 21:11:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-22T21:11:12Z</dc:date>
    <item>
      <title>Function Module for Excel and Email</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617741#M276492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to write some ABAP routine in BW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the scenario:&lt;/P&gt;&lt;P&gt;Reading records from request packet, storing it in some internal table, and then by calling some FM to store in Excel Sheet, and then sending that excel sheet on external mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whats the Function Modules for saving the output into excel format and sending the file using email?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Sep 2006 21:11:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617741#M276492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-22T21:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for Excel and Email</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617742#M276493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use SO_DOCUMENT_SEND_API1 to send excel attachments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample code to send excel as an attachment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report ZMAILTEST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_email   type somlreci1-receiver&lt;/P&gt;&lt;P&gt; default 'you@yourcompany.com'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of it001 occurs 0,&lt;/P&gt;&lt;P&gt;      bukrs type t001-bukrs,&lt;/P&gt;&lt;P&gt;      butxt type t001-butxt,&lt;/P&gt;&lt;P&gt;      end of it001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:   imessage type standard table of solisti1 with header line,&lt;/P&gt;&lt;P&gt;        iattach type standard table of solisti1 with header line,&lt;/P&gt;&lt;P&gt;        ipacking_list like sopcklsti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;        ireceivers like somlreci1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;        iattachment like solisti1 occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select bukrs butxt into table it001 from t001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Populate table with detaisl to be entered into .xls file&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform build_xls_data .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate message body text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  clear imessage.   refresh imessage.&lt;/P&gt;&lt;P&gt;  imessage = 'Please find attached excel file'.&lt;/P&gt;&lt;P&gt;  append imessage.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Send file by email as .xls speadsheet&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  perform send_email_with_xls tables imessage&lt;/P&gt;&lt;P&gt;                                      iattach&lt;/P&gt;&lt;P&gt;                                using p_email&lt;/P&gt;&lt;P&gt;                                      'Example Excel Attachment'&lt;/P&gt;&lt;P&gt;                                      'XLS'&lt;/P&gt;&lt;P&gt;                                      'TestFileName'&lt;/P&gt;&lt;P&gt;                                      'CompanyCodes'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Form  BUILD_XLS_DATA&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form build_xls_data .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  constants: con_cret type x value '0D',  "OK for non Unicode&lt;/P&gt;&lt;P&gt;             con_tab type x value '09'.   "OK for non Unicode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*If you have Unicode check active in program attributes thnen you will&lt;/P&gt;&lt;P&gt;*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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   con_tab  type c value cl_abap_char_utilities=&amp;gt;HORIZONTAL_TAB,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   con_cret type c value cl_abap_char_utilities=&amp;gt;CR_LF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  concatenate 'BUKRS' 'BUTXT'&lt;/P&gt;&lt;P&gt;         into iattach separated by con_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  concatenate con_cret iattach into iattach.&lt;/P&gt;&lt;P&gt;  append  iattach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at it001.&lt;/P&gt;&lt;P&gt;    concatenate it001-bukrs it001-butxt&lt;/P&gt;&lt;P&gt;           into iattach separated by con_tab.&lt;/P&gt;&lt;P&gt;    concatenate con_cret iattach  into iattach.&lt;/P&gt;&lt;P&gt;    append  iattach.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     Form  SEND_EMAIL_WITH_XLS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;form send_email_with_xls tables pit_message&lt;/P&gt;&lt;P&gt;                                          pit_attach&lt;/P&gt;&lt;P&gt;                                    using p_email&lt;/P&gt;&lt;P&gt;                                          p_mtitle&lt;/P&gt;&lt;P&gt;                                          p_format&lt;/P&gt;&lt;P&gt;                                          p_filename&lt;/P&gt;&lt;P&gt;                                          p_attdescription.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data: xdocdata like sodocchgi1,&lt;/P&gt;&lt;P&gt;        xcnt type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill the document data.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  xdocdata-doc_size = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate the subject/generic message attributes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  xdocdata-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;  xdocdata-obj_name  = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;  xdocdata-obj_descr = p_mtitle .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill the document data and get size of attachment&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  clear xdocdata.&lt;/P&gt;&lt;P&gt;  read table iattach index xcnt.&lt;/P&gt;&lt;P&gt;  xdocdata-doc_size =&lt;/P&gt;&lt;P&gt;     ( xcnt - 1 ) * 255 + strlen( iattach ).&lt;/P&gt;&lt;P&gt;  xdocdata-obj_langu  = sy-langu.&lt;/P&gt;&lt;P&gt;  xdocdata-obj_name   = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;  xdocdata-obj_descr  = p_mtitle.&lt;/P&gt;&lt;P&gt;  clear iattachment.  refresh iattachment.&lt;/P&gt;&lt;P&gt;  iattachment[] = pit_attach[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Describe the body of the message&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  clear ipacking_list.  refresh ipacking_list.&lt;/P&gt;&lt;P&gt;  ipacking_list-transf_bin = space.&lt;/P&gt;&lt;P&gt;  ipacking_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  ipacking_list-head_num = 0.&lt;/P&gt;&lt;P&gt;  ipacking_list-body_start = 1.&lt;/P&gt;&lt;P&gt;  describe table imessage lines ipacking_list-body_num.&lt;/P&gt;&lt;P&gt;  ipacking_list-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;  append ipacking_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create attachment notification&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ipacking_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;  ipacking_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  ipacking_list-head_num   = 1.&lt;/P&gt;&lt;P&gt;  ipacking_list-body_start = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  describe table iattachment lines ipacking_list-body_num.&lt;/P&gt;&lt;P&gt;  ipacking_list-doc_type   =  p_format.&lt;/P&gt;&lt;P&gt;  ipacking_list-obj_descr  =  p_attdescription.&lt;/P&gt;&lt;P&gt;  ipacking_list-obj_name   =  p_filename.&lt;/P&gt;&lt;P&gt;  ipacking_list-doc_size   =  ipacking_list-body_num * 255.&lt;/P&gt;&lt;P&gt;  append ipacking_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Add the recipients email address&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  clear ireceivers.  refresh ireceivers.&lt;/P&gt;&lt;P&gt;  ireceivers-receiver = p_email.&lt;/P&gt;&lt;P&gt;  ireceivers-rec_type = 'U'.&lt;/P&gt;&lt;P&gt;  ireceivers-com_type = 'INT'.&lt;/P&gt;&lt;P&gt;  ireceivers-notif_del = 'X'.&lt;/P&gt;&lt;P&gt;  ireceivers-notif_ndel = 'X'.&lt;/P&gt;&lt;P&gt;  append ireceivers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call function 'SO_DOCUMENT_SEND_API1'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            document_data              = xdocdata&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;            packing_list               = ipacking_list&lt;/P&gt;&lt;P&gt;            contents_bin               = iattachment&lt;/P&gt;&lt;P&gt;            contents_txt               = imessage&lt;/P&gt;&lt;P&gt;            receivers                  = ireceivers&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Sep 2006 21:38:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617742#M276493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-22T21:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for Excel and Email</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617743#M276494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That looks a little familar.  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="199562"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Sep 2006 00:00:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617743#M276494</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-09-23T00:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Function Module for Excel and Email</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617744#M276495</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;Go through the link,&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/email/attachhome.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/email/attachhome.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Azaz Ali.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Sep 2006 21:05:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-for-excel-and-email/m-p/1617744#M276495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-23T21:05:22Z</dc:date>
    </item>
  </channel>
</rss>

