<?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: SO_NEW_DOCUMENT_ATT_SEND_API1 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664373#M294242</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi prabha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly chk ur code with this sample pgm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will help u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;email with excel atach:&amp;lt;/i&amp;gt;&amp;lt;/b&amp;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;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="221840"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/excel-attachment-for-sending-email-externally-625122" target="test_blank"&gt;http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/excel-attachment-for-sending-email-externally-625122&lt;/A&gt;&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="754377"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;if hlpful pls mark points&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Oct 2006 13:17:34 GMT</pubDate>
    <dc:creator>anversha_s</dc:creator>
    <dc:date>2006-10-31T13:17:34Z</dc:date>
    <item>
      <title>SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664372#M294241</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'm using SO_NEW_DOCUMENT_ATT_SEND_API1 FM to send email with attachments of type XLS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The email is sent successfully but when try to open the attachment getting message as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not in recognisable format. When the document is opened the values ar enot properly displayed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls help what could the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code is :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data Intabb like standard table of mara with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara into table Intabb.&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;Creation of the document to be sent&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;doc_chng-obj_name = 'ANGEBOT'.&lt;/P&gt;&lt;P&gt;doc_chng-obj_DESCR = 'BG test description'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objtxt = 'Please see attached document containing'.&lt;/P&gt;&lt;P&gt;append objtxt.&lt;/P&gt;&lt;P&gt;objtxt = 'Material Details.'.&lt;/P&gt;&lt;P&gt;append objtxt.&lt;/P&gt;&lt;P&gt;objtxt = '                 Regards,'.&lt;/P&gt;&lt;P&gt;append objtxt.&lt;/P&gt;&lt;P&gt;objtxt = '                        SAP.'.&lt;/P&gt;&lt;P&gt;append objtxt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Describe table objtxt lines tab_lines.&lt;/P&gt;&lt;P&gt;Read table objtxt index tab_lines.&lt;/P&gt;&lt;P&gt;Doc_chng-doc_size = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creation of the entry for the compressed document&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear objpack-transf_bin.&lt;/P&gt;&lt;P&gt;objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;objpack-head_num = 0.&lt;/P&gt;&lt;P&gt;objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;objpack-body_num = tab_lines.&lt;/P&gt;&lt;P&gt;objpack-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;append objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Creation of the document attachment&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Assume that the data in OBJBIN is in TXT format&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT Intabb.&lt;/P&gt;&lt;P&gt;CONCATENATE INTABB-matnr INTABB-mandt INTO OBJBIN.&lt;/P&gt;&lt;P&gt;    Append objBin.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Describe table objbin lines tab_lines.&lt;/P&gt;&lt;P&gt;*Objhead = 'Mat.xls'.&lt;/P&gt;&lt;P&gt;*Append Objhead.&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;Creation of the entry for the compressed attachment&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear objpack-transf_bin.&lt;/P&gt;&lt;P&gt;objpack-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;objpack-head_start = 1.&lt;/P&gt;&lt;P&gt;objpack-head_num = 1.&lt;/P&gt;&lt;P&gt;objpack-body_start = 1.&lt;/P&gt;&lt;P&gt;objpack-body_num = tab_lines.&lt;/P&gt;&lt;P&gt;objpack-doc_type = 'XLS'.&lt;/P&gt;&lt;P&gt;objpack-obj_name = 'ANLAGE'.&lt;/P&gt;&lt;P&gt;objpack-obj_descr = 'OM_GGCS Cork Ireland Report_Date_Time'.&lt;/P&gt;&lt;P&gt;objpack-doc_size = tab_lines * 255.&lt;/P&gt;&lt;P&gt;append objpack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reclist-receiver = '09022426'.&lt;/P&gt;&lt;P&gt;reclist-express = 'X'.&lt;/P&gt;&lt;P&gt;reclist-rec_type = 'B'.&lt;/P&gt;&lt;P&gt;append reclist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sending The Document&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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 = doc_chng&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           put_in_outbox = 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    Tables&lt;/P&gt;&lt;P&gt;            Packing_list = objpack&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           object_header = objhead&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            contents_bin = objbin&lt;/P&gt;&lt;P&gt;            contents_txt = objtxt&lt;/P&gt;&lt;P&gt;            Receivers = reclist&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;             Operation_no_authorization = 4&lt;/P&gt;&lt;P&gt;             others = 99.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2006 13:15:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664372#M294241</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-31T13:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664373#M294242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi prabha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly chk ur code with this sample pgm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will help u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;email with excel atach:&amp;lt;/i&amp;gt;&amp;lt;/b&amp;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;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="221840"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/excel-attachment-for-sending-email-externally-625122" target="test_blank"&gt;http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/excel-attachment-for-sending-email-externally-625122&lt;/A&gt;&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="754377"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;if hlpful pls mark points&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2006 13:17:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664373#M294242</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-10-31T13:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664374#M294243</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...&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm" target="test_blank"&gt;http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2006 13:20:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664374#M294243</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-31T13:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664375#M294244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prabha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think the doc_size isn't correct.&lt;/P&gt;&lt;P&gt;I did it in this way:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;OBJ_PACK-DOC_SIZE   = ( tab_lines - 1 ) * 255.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2006 13:21:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664375#M294244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-31T13:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664376#M294245</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;Thanks for reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again i get athe same error for the codes which u have given.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The file is not in recongized format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2006 14:46:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664376#M294245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-31T14:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_ATT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664377#M294246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prapha,&lt;/P&gt;&lt;P&gt;look at OSS-Note 190669.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And how many rows do you have in your itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Test try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara into table Intabb up to 100 rows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2006 15:45:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-att-send-api1/m-p/1664377#M294246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-31T15:45:32Z</dc:date>
    </item>
  </channel>
</rss>

