<?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_SEND_API1 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310067#M1027454</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yes it is possiable.&lt;/P&gt;&lt;P&gt;see this example code&lt;/P&gt;&lt;P&gt;report zcl_testmail.&lt;/P&gt;&lt;P&gt;tables: ekko.&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 'Ur mail address'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of t_ekpo,&lt;/P&gt;&lt;P&gt;ebeln type ekpo-ebeln,&lt;/P&gt;&lt;P&gt;ebelp type ekpo-ebelp,&lt;/P&gt;&lt;P&gt;aedat type ekpo-aedat,&lt;/P&gt;&lt;P&gt;matnr type ekpo-matnr,&lt;/P&gt;&lt;P&gt;end of t_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_ekpo type standard table of t_ekpo initial size 0,&lt;/P&gt;&lt;P&gt;wa_ekpo type t_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of t_charekpo,&lt;/P&gt;&lt;P&gt;ebeln(10) type c,&lt;/P&gt;&lt;P&gt;ebelp(5) type c,&lt;/P&gt;&lt;P&gt;aedat(8) type c,&lt;/P&gt;&lt;P&gt;matnr(18) type c,&lt;/P&gt;&lt;P&gt;end of t_charekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_charekpo type t_charekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_message type standard table of solisti1 initial size 0&lt;/P&gt;&lt;P&gt;with header line.&lt;/P&gt;&lt;P&gt;data: it_attach type standard table of solisti1 initial size 0&lt;/P&gt;&lt;P&gt;with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: t_packing_list like sopcklsti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_contents like solisti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_receivers like somlreci1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_attachment like solisti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_object_header like solisti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;w_cnt type i,&lt;/P&gt;&lt;P&gt;w_sent_all(1) type c,&lt;/P&gt;&lt;P&gt;w_doc_data like sodocchgi1,&lt;/P&gt;&lt;P&gt;gd_error type sy-subrc,&lt;/P&gt;&lt;P&gt;gd_reciever type sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*START_OF_SELECTION&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Retrieve sample data from table ekpo&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform data_retrieval.&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_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*END-OF-SELECTION&lt;/P&gt;&lt;P&gt;end-of-selection.&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;perform populate_email_message_body.&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_file_as_email_attachment&lt;/P&gt;&lt;P&gt;tables it_message&lt;/P&gt;&lt;P&gt;it_attach&lt;/P&gt;&lt;P&gt;using p_email&lt;/P&gt;&lt;P&gt;'Example .xls documnet attachment'&lt;/P&gt;&lt;P&gt;'XLS'&lt;/P&gt;&lt;P&gt;'filename'&lt;/P&gt;&lt;P&gt;' '&lt;/P&gt;&lt;P&gt;' '&lt;/P&gt;&lt;P&gt;' '&lt;/P&gt;&lt;P&gt;changing gd_error&lt;/P&gt;&lt;P&gt;gd_reciever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Instructs mail send program for SAPCONNECT to send email(rsconn01)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform initiate_mail_execute_program.&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 DATA_RETRIEVAL&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Retrieve data form EKPO table and populate itab it_ekko&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;form data_retrieval.&lt;/P&gt;&lt;P&gt;select ebeln ebelp aedat matnr&lt;/P&gt;&lt;P&gt;up to 10 rows&lt;/P&gt;&lt;P&gt;from ekpo&lt;/P&gt;&lt;P&gt;into table it_ekpo.&lt;/P&gt;&lt;P&gt;endform. " DATA_RETRIEVAL&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 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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build data table for .xls document&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;form build_xls_data_table.&lt;/P&gt;&lt;P&gt;constants: con_cret(20) type c value '0D', "OK for non Unicode&lt;/P&gt;&lt;P&gt;con_tab(20) type c 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;&lt;/P&gt;&lt;P&gt;concatenate 'EBELN' 'EBELP' 'AEDAT' 'MATNR'&lt;/P&gt;&lt;P&gt;into it_attach separated by con_tab.&lt;/P&gt;&lt;P&gt;concatenate con_cret it_attach into it_attach.&lt;/P&gt;&lt;P&gt;append it_attach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_ekpo into wa_charekpo.&lt;/P&gt;&lt;P&gt;concatenate wa_charekpo-ebeln wa_charekpo-ebelp&lt;/P&gt;&lt;P&gt;wa_charekpo-aedat wa_charekpo-matnr&lt;/P&gt;&lt;P&gt;into it_attach separated by con_tab.&lt;/P&gt;&lt;P&gt;concatenate con_cret it_attach into it_attach.&lt;/P&gt;&lt;P&gt;append it_attach.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endform. " BUILD_XLS_DATA_TABLE&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 SEND_FILE_AS_EMAIL_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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Send email&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;form send_file_as_email_attachment 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;p_sender_address&lt;/P&gt;&lt;P&gt;p_sender_addres_type&lt;/P&gt;&lt;P&gt;changing p_error&lt;/P&gt;&lt;P&gt;p_reciever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: ld_error type sy-subrc,&lt;/P&gt;&lt;P&gt;ld_reciever type sy-subrc,&lt;/P&gt;&lt;P&gt;ld_mtitle like sodocchgi1-obj_descr,&lt;/P&gt;&lt;P&gt;ld_email like somlreci1-receiver,&lt;/P&gt;&lt;P&gt;ld_format type so_obj_tp ,&lt;/P&gt;&lt;P&gt;ld_attdescription type so_obj_nam ,&lt;/P&gt;&lt;P&gt;ld_attfilename type so_obj_des ,&lt;/P&gt;&lt;P&gt;ld_sender_address like soextreci1-receiver,&lt;/P&gt;&lt;P&gt;ld_sender_address_type like soextreci1-adr_typ,&lt;/P&gt;&lt;P&gt;ld_receiver like sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ld_email = p_email.&lt;/P&gt;&lt;P&gt;ld_mtitle = p_mtitle.&lt;/P&gt;&lt;P&gt;ld_format = p_format.&lt;/P&gt;&lt;P&gt;ld_attdescription = p_attdescription.&lt;/P&gt;&lt;P&gt;ld_attfilename = p_filename.&lt;/P&gt;&lt;P&gt;ld_sender_address = p_sender_address.&lt;/P&gt;&lt;P&gt;ld_sender_address_type = p_sender_addres_type.&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;Fill the document data.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;w_doc_data-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;w_doc_data-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_name = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_descr = ld_mtitle .&lt;/P&gt;&lt;P&gt;w_doc_data-sensitivty = 'F'.&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 w_doc_data.&lt;/P&gt;&lt;P&gt;read table it_attach index w_cnt.&lt;/P&gt;&lt;P&gt;w_doc_data-doc_size =&lt;/P&gt;&lt;P&gt;( w_cnt - 1 ) * 255 + strlen( it_attach ).&lt;/P&gt;&lt;P&gt;w_doc_data-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_name = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_descr = ld_mtitle.&lt;/P&gt;&lt;P&gt;w_doc_data-sensitivty = 'F'.&lt;/P&gt;&lt;P&gt;clear t_attachment.&lt;/P&gt;&lt;P&gt;refresh t_attachment.&lt;/P&gt;&lt;P&gt;t_attachment[] = 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 t_packing_list.&lt;/P&gt;&lt;P&gt;refresh t_packing_list.&lt;/P&gt;&lt;P&gt;t_packing_list-transf_bin = space.&lt;/P&gt;&lt;P&gt;t_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;t_packing_list-head_num = 0.&lt;/P&gt;&lt;P&gt;t_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;describe table it_message lines t_packing_list-body_num.&lt;/P&gt;&lt;P&gt;t_packing_list-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;append t_packing_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;t_packing_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;t_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;t_packing_list-head_num = 1.&lt;/P&gt;&lt;P&gt;t_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table t_attachment lines t_packing_list-body_num.&lt;/P&gt;&lt;P&gt;t_packing_list-doc_type = ld_format.&lt;/P&gt;&lt;P&gt;t_packing_list-obj_descr = ld_attdescription.&lt;/P&gt;&lt;P&gt;t_packing_list-obj_name = ld_attfilename.&lt;/P&gt;&lt;P&gt;t_packing_list-doc_size = t_packing_list-body_num * 255.&lt;/P&gt;&lt;P&gt;append t_packing_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 t_receivers.&lt;/P&gt;&lt;P&gt;refresh t_receivers.&lt;/P&gt;&lt;P&gt;t_receivers-receiver = ld_email.&lt;/P&gt;&lt;P&gt;t_receivers-rec_type = 'U'.&lt;/P&gt;&lt;P&gt;t_receivers-com_type = 'INT'.&lt;/P&gt;&lt;P&gt;t_receivers-notif_del = 'X'.&lt;/P&gt;&lt;P&gt;t_receivers-notif_ndel = 'X'.&lt;/P&gt;&lt;P&gt;append t_receivers.&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 = w_doc_data&lt;/P&gt;&lt;P&gt;put_in_outbox = 'X'&lt;/P&gt;&lt;P&gt;sender_address = ld_sender_address&lt;/P&gt;&lt;P&gt;sender_address_type = ld_sender_address_type&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 = w_sent_all&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;packing_list = t_packing_list&lt;/P&gt;&lt;P&gt;contents_bin = t_attachment&lt;/P&gt;&lt;P&gt;contents_txt = it_message&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate zerror return code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ld_error = sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate zreceiver return code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;loop at t_receivers.&lt;/P&gt;&lt;P&gt;ld_receiver = t_receivers-retrn_code.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endform.&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 INITIATE_MAIL_EXECUTE_PROGRAM&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Instructs mail send program for SAPCONNECT to send email.&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;form initiate_mail_execute_program.&lt;/P&gt;&lt;P&gt;wait up to 2 seconds.&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;endform. " INITIATE_MAIL_EXECUTE_PROGRAM&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 POPULATE_EMAIL_MESSAGE_BODY&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;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;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form populate_email_message_body.&lt;/P&gt;&lt;P&gt;refresh it_message.&lt;/P&gt;&lt;P&gt;it_message = 'Hi this is a test mail'.&lt;/P&gt;&lt;P&gt;append it_message.&lt;/P&gt;&lt;P&gt;Endform.&lt;/P&gt;&lt;P&gt;You can check the mail in &lt;STRONG&gt;sost&lt;/STRONG&gt; t-code.&lt;/P&gt;&lt;P&gt;hope it is helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Aug 2008 09:00:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-04T09:00:57Z</dc:date>
    <item>
      <title>SO_NEW_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310063#M1027450</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;is it possible to send an attachment with help of this function module and at the same time give some message in the body.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if so, please give an example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;helpful answers will be rewarded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 08:34:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310063#M1027450</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T08:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310064#M1027451</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;Here is the code to send message with the attachment... just go through this . i hope will give u some help..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;program  zemailtest_with_attachment.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This example shows how to send&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  - a simple text provided in an internal table of text lines&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  - and an attached MS word document provided in internal table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  - to some internet email address.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;class ca_sapuser_bcs     definition load.&lt;/P&gt;&lt;P&gt;class cl_cam_address_bcs definition load.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;data: send_request       type ref to cl_bcs.&lt;/P&gt;&lt;P&gt;data: text               type bcsy_text.&lt;/P&gt;&lt;P&gt;data: binary_content     type solix_tab.&lt;/P&gt;&lt;P&gt;data: document           type ref to cl_document_bcs.&lt;/P&gt;&lt;P&gt;data: sender             type ref to cl_sapuser_bcs.&lt;/P&gt;&lt;P&gt;data: recipient          type ref to if_recipient_bcs.&lt;/P&gt;&lt;P&gt;data: bcs_exception      type ref to cx_bcs.&lt;/P&gt;&lt;P&gt;data: sent_to_all        type os_boolean.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;data: document_data like  sofolenti1,&lt;/P&gt;&lt;P&gt;      doc_id    like sofolenti1-doc_id,&lt;/P&gt;&lt;P&gt;      cont_hex  like solix occurs 100,&lt;/P&gt;&lt;P&gt;      cont_text type soli_tab,&lt;/P&gt;&lt;P&gt;      cont_hex1 like solix occurs 10.&lt;/P&gt;&lt;P&gt;data: attachment type ref to if_document_bcs.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &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;    perform main.&lt;/P&gt;&lt;P&gt; &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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      FORM main                                                     *&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;form main.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  try.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    -------- create persistent send request ------------------------&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      send_request = cl_bcs=&amp;gt;create_persistent( ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    -------- create and set document with attachment ---------------&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    create document from internal table with text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      append 'Hello world!' to text.&lt;/P&gt;&lt;P&gt;      document = cl_document_bcs=&amp;gt;create_document(&lt;/P&gt;&lt;P&gt;                    i_type    = 'RAW'&lt;/P&gt;&lt;P&gt;                    i_text    = text&lt;/P&gt;&lt;P&gt;                    i_length  = '12'&lt;/P&gt;&lt;P&gt;                    i_subject = 'main document created by whatever  ' ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    create attachment&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      clear text.&lt;/P&gt;&lt;P&gt;      append 'This is the attachment text!' to text.    "#EC NOTEXT&lt;/P&gt;&lt;P&gt;      attachment = cl_document_bcs=&amp;gt;create_document(&lt;/P&gt;&lt;P&gt;                                    i_type    = 'RAW'&lt;/P&gt;&lt;P&gt;                                    i_text    = text&lt;/P&gt;&lt;P&gt;                                    i_length  = '11'&lt;/P&gt;&lt;P&gt;                                    i_subject = 'attachment...' ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    add (existing) attachment to main document&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method document-&amp;gt;add_document_as_attachment&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          im_document     = attachment&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;    add document to send request&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method send_request-&amp;gt;set_document( document ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    --------- add recipient (e-mail address) -----------------------&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    create recipient&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      recipient = cl_cam_address_bcs=&amp;gt;create_internet_address(    " your email address  &lt;/P&gt;&lt;P&gt;                                        'youremailaddres here ' ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    add recipient with its respective attributes to send request&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      call method send_request-&amp;gt;add_recipient&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          i_recipient  = recipient&lt;/P&gt;&lt;P&gt;          i_express    = 'X'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    ---------- send document ---------------------------------------&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      send_request-&amp;gt;send_request-&amp;gt;set_link_to_outbox( 'X' ).&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      call method send_request-&amp;gt;send(&lt;/P&gt;&lt;P&gt;        exporting&lt;/P&gt;&lt;P&gt;          i_with_error_screen = 'X'&lt;/P&gt;&lt;P&gt;        receiving&lt;/P&gt;&lt;P&gt;          result              = sent_to_all ).&lt;/P&gt;&lt;P&gt;      if sent_to_all = 'X'.&lt;/P&gt;&lt;P&gt;        write text-003.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      commit work.&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;-----------------------------------------------------------&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;*                     exception handling&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;-----------------------------------------------------------&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;* replace this very rudimentary exception handling&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;* with your own one !!!&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;-----------------------------------------------------------&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  catch cx_bcs into bcs_exception.&lt;/P&gt;&lt;P&gt;    write: 'error  resultes.'(001).&lt;/P&gt;&lt;P&gt;    write: 'messtype:'(002), bcs_exception-&amp;gt;error_type.&lt;/P&gt;&lt;P&gt;    exit.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  endtry.&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;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>Mon, 04 Aug 2008 08:41:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310064#M1027451</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T08:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310065#M1027452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hiii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yse we can send an attachment by using this FM and can write some message too..just refer to following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SET BODY-TEXT (if any)...
* IF NOT t_content[] IS INITIAL.
  IF NOT t_con_text[] IS INITIAL.
*   t_con_text[] = t_content[].

*   Write Packing List (Main) for BODY-TEXT
    DESCRIBE TABLE t_con_text LINES h_tab_cntr.
    READ TABLE t_con_text INDEX h_tab_cntr.
    h_doc_data-doc_size = ( h_tab_cntr - 1 )
                        * 255 + STRLEN( t_con_text ).
    CLEAR t_pak_list.
    t_pak_list-head_start = 1.
    t_pak_list-head_num = 0.
    t_pak_list-body_start = 1.
    t_pak_list-body_num = h_tab_cntr.
    t_pak_list-doc_type = 'RAW'.
    APPEND t_pak_list.
  ELSE.
*   Write Packing List (Main) for NO BODY-TEXT (force spaces)
    t_con_text = space. APPEND t_con_text.
    CLEAR t_pak_list.
    t_pak_list-head_start = 1.
    t_pak_list-head_num = 0.
    t_pak_list-body_start = 1.
    t_pak_list-body_num = 1.
    t_pak_list-doc_type = 'RAW'.
    APPEND t_pak_list.
  ENDIF.
*   ofttab-tdprintcom = 'EP'.
* Check for OTF-2-PDF attachment (via T_ITCOO input table)...
  IF NOT ofttab[] IS INITIAL.           " Something passed?
    h_commit_wk = space.               " YES - reset commit-work
    t_itcoo[] = ofttab[].               " ... - set OTF file...
    PERFORM convert_otf_2_pdf.         " ... - go convert to PDF...

    perform conversion_of_size.

  ENDIF.

* Check for NO OTF-2-PDF attachment &amp;amp; Spool-ID...
  IF ofttab[] IS INITIAL AND            " Empty &amp;amp;
     NOT d_spool_id IS INITIAL.        " .. got SPOOL number?
*    SELECT SINGLE rqident              " YES - check for valid
*             INTO tsp01-rqident        " ... - .. entry in
*             FROM tsp01                " ... - ... spool...
*            WHERE rqident = d_spool_id.                     "
    IF sy-subrc NE 0.                  " ... - Nothing?
      RAISE invalid_spool_id.          " ... - YES - post it...
    ELSE.                              " ... - NO  -
      PERFORM convert_otf_2_pdf_sx.    " ... - convert to PDF (new way)!
     perform conversion_of_size.

    ENDIF.
  ENDIF.

* Begin of ADDS for project ENABLE
* Check for ABAPLIST as attachment (via T_ABABLIST input table)...
*  IF NOT t_abaplist[] IS INITIAL.      " Something passed?
*    t_list[] = t_abaplist[].           " YES - set table...
*    IF d_desired_type IS INITIAL.      " ... - desired type passed?
*      d_desired_type = 'RAW'.          " ... - NO  - set default
*    ENDIF.                             " ... - end...
*  ENDIF.                               " end...

  FIELD-SYMBOLS:
    &amp;lt;fs_org&amp;gt; TYPE ANY,
    &amp;lt;fs_kunnr&amp;gt; TYPE ANY.
  DATA:
    w_salorg_field(20) TYPE c,
    w_kunnr_field(20) TYPE c,
    w_subrc.

  DATA:
    w_departure_ctry LIKE adrc-country,
    w_destination_ctry LIKE adrc-country.

    IF nast-kschl = 'ZDA0' OR
       nast-kschl = 'ZDAS' OR
       nast-kschl = 'ZPAS' OR
       nast-kschl = 'ZQCA'.
      MOVE:
        'VBDKL-VKORG' TO w_salorg_field,
        'VBDKL-KUNWE' TO w_kunnr_field.

    ELSEIF nast-kschl EQ 'ZBA0'.
      MOVE:
        'VBDKA-VKORG' TO w_salorg_field,
        'VBDKA-KUNNR' TO w_kunnr_field.

    ELSEIF nast-kschl EQ 'ZRD3'.
      MOVE:
        'VBDKR-VKORG' TO w_salorg_field,
        'VBDKR-KUNRE' TO w_kunnr_field.

    ELSEIF nast-kschl EQ 'ZLR0'.
      MOVE:
        'VBRK-VKORG' TO w_salorg_field,
        'W_BILLTO' TO w_kunnr_field.
    ENDIF.

    IF w_salorg_field IS NOT INITIAL.
      ASSIGN (w_salorg_field) TO &amp;lt;fs_org&amp;gt;.
* Select the Departure Country
      SELECT SINGLE country
        INTO w_departure_ctry
        FROM tvko AS t JOIN adrc AS a
          ON t~adrnr EQ a~addrnumber
       WHERE t~vkorg EQ &amp;lt;fs_org&amp;gt;
         AND a~date_from LE sy-datum.
    ENDIF.

    IF w_kunnr_field IS NOT INITIAL.
      ASSIGN (w_kunnr_field) TO &amp;lt;fs_kunnr&amp;gt;.
* select destination country
      SELECT SINGLE land1
        FROM kna1
        INTO w_destination_ctry
       WHERE kunnr EQ &amp;lt;fs_kunnr&amp;gt;.
    ENDIF.
* Compare the destination and departure country
* Send PDF to Application server only if destination and departure countries will be the same
* This is because ALE output will not be triggered for Export customers
*  if nast-nacha eq '5'.                "
    IF w_destination_ctry IS NOT INITIAL AND
       w_departure_ctry IS NOT INITIAL.
      IF w_destination_ctry EQ w_departure_ctry.
        MOVE 'X' TO w_subrc.

      ENDIF.
    ENDIF.
*  endif.                               " if nast-nacha ne '7'.
*    IF w_subrc EQ 'X'.
*
      IF nast-kschl = 'ZDA0' OR
         nast-kschl = 'ZDAS' OR
         nast-kschl = 'ZRD3' OR
         nast-kschl = 'ZBA0' OR
         nast-kschl = 'ZPAS' OR             " D47K915851
         nast-kschl = 'ZQCA' OR             " D47K915851
         nast-kschl = 'ZLR0'.               

*   Finding the Company Code
        CASE nast-kschl.

          WHEN 'ZDA0'.
            MOVE 'VBDKL-BUKRS' TO w_field.
            WRITE (w_field) TO w_ccode.
          WHEN  'ZDAS'.
            MOVE 'VBDKL-BUKRS' TO w_field.
            WRITE (w_field) TO w_ccode.
          WHEN 'ZRD3'.
            MOVE 'VBDKR-BUKRS' TO w_field.
            WRITE (w_field) TO w_ccode.
          WHEN 'ZBA0'.
            MOVE 'VBDKA-BUKRS_VF' TO w_field.
            WRITE (w_field) TO w_ccode.
          WHEN 'ZPAS'.
            MOVE 'VBDKL-BUKRS' TO w_field.
            WRITE (w_field) TO w_ccode.
          WHEN 'ZQCA'.
            MOVE 'VBDKL-BUKRS' TO w_field.
            WRITE (w_field) TO w_ccode.
          WHEN 'ZLR0'.                             
            MOVE 'VBRK-BUKRS' TO w_field.
            WRITE (w_field) TO w_ccode.

        ENDCASE.
        IF w_ccode EQ 'JP01'
         OR w_ccode EQ 'CN02'
         OR w_ccode EQ 'TW02'.


  IF t_soli[] IS NOT INITIAL.
    t_app_pdf[] = t_soli[].
*     Find the path of Logical System
    SELECT SINGLE outputdir
             FROM edipox
             INTO w_dsn
            WHERE port = w_port.
    CONCATENATE  w_dsn
                 nast-kschl '_'
                 nast-objky '_'
                 w_ccode
                 '.DAT'
            INTO w_dsn.

    CONDENSE w_dsn.
*   Storing the file in Appln. Server in above path
*    OPEN DATASET w_dsn FOR OUTPUT IN BINARY MODE.
*    IF sy-subrc = 0.
*      LOOP AT t_app_pdf.
*        TRANSFER t_app_pdf TO w_dsn.
*      ENDLOOP.
*      CLOSE DATASET w_dsn.
**    Nothing to do
*    ENDIF.                       " IF sy-subrc = 0.
  ENDIF.                         " IF t_soli[]
        ENDIF.                            " IF w_ccode eq 'JP01'
      ENDIF.                             " IF NAST-KSCHL
    ENDIF.
*  ENDIF.

** Check for any ATTACHMENTS...
 IF d_desired_type = 'RAW'.           " Set to RAW?
*    PERFORM convert_to_abaplist.       " YES - convert it
  ENDIF.                               " end...
  IF d_desired_type = 'ALI'.           " Set to ALI?
    PERFORM convert_to_alilist.        " YES - convert it
  ENDIF.                               " end...

* Check for any ATTACHMENTS...
  IF NOT t_soli[] IS INITIAL.          " attachment?
    h_real_type = d_desired_type.      " ENABLE
    h_transf_type = 'X'.               " Transfer type BINARY...


*   Write PDF/ALI formatted data to BINARY table...
    t_con_bin[] = t_soli[].

*   Add Packing List (attachment) for PDF...
    DESCRIBE TABLE t_con_bin LINES h_tab_cntr.
    READ TABLE t_con_bin INDEX h_tab_cntr.
    h_doc_data-doc_size = h_doc_data-doc_size
                        + ( ( h_tab_cntr - 1 )
                        * 255 + STRLEN( t_con_bin ) ).
    h_doc_data-obj_descr  = mail_subject.
    h_body_start = 1.
    h_body_num = h_tab_cntr.

*   Write RAW data if that's what it is (adds to TEXT)...
    IF h_real_type = 'RAW'.
      DESCRIBE TABLE t_con_text LINES h_body_start.
      h_body_start = h_body_start + 1.

      h_transf_type = space.           " Transfer type TEXT...
      LOOP AT t_con_bin.               " Zip thru TEXT stuff
        t_con_text = t_con_bin.        " set TEXT table header..
        APPEND t_con_text.             " add to what's there!
      ENDLOOP.
      CLEAR: t_con_bin.                " clear BINARY header..
      REFRESH: t_con_bin.              " reset BINARY table...
    ENDIF.

    CLEAR t_pak_list.
    IF h_transf_type = 'X'.            " Binary=PDF/ALI?
      t_pak_list-transf_bin = 'X'.
      t_pak_list-head_start = 1.
      t_pak_list-head_num   = 0.
      t_pak_list-body_start = 1.
      t_pak_list-body_num   = h_tab_cntr.
      t_pak_list-doc_type   = h_real_type.
      t_pak_list-obj_name   = 'ATTACHMENT'.
      t_pak_list-obj_descr  = 'Document'(001).
      t_pak_list-doc_size   = ( h_tab_cntr - 1 )
                            * 255 + STRLEN( t_con_bin ).
    ELSE.
      DESCRIBE TABLE t_con_text LINES h_tab_cntr.
      READ TABLE t_con_text INDEX h_tab_cntr.
      t_pak_list-transf_bin = ' '.     " Binary=RAW
      t_pak_list-head_start = 1.
      t_pak_list-head_num   = 0.
      t_pak_list-body_start = h_body_start.
      t_pak_list-body_num   = h_tab_cntr.
      t_pak_list-doc_type   = h_real_type.
      t_pak_list-obj_name   = 'ATTACHMENT'(002).
      t_pak_list-obj_descr  = 'Report'(003).
      t_pak_list-doc_size   = ( h_body_num - 1 )
                            * 255 + STRLEN( t_con_text ).
    ENDIF.
    APPEND t_pak_list.
  ENDIF.


* Send the EMAIL out with SAP function...
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = h_doc_data
      put_in_outbox              = 'X'
*      commit_work                = 'X'
    TABLES
      packing_list               = t_pak_list
      contents_bin               = t_con_bin
      contents_txt               = t_con_text
      receivers                  = t_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.

  IF syst-subrc NE 0.
*    RAISE send_failed.
    CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
      EXPORTING
        msg_arbgb = '00'
        msg_nr    = '001'
        msg_ty    = 'E'
        msg_v1    = 'O/P Could not be issued '(001)
        msg_v2    = ' Due to No Mail ID'(002)
        msg_v3    = syst-msgv3
        msg_v4    = syst-msgv4
      EXCEPTIONS
        OTHERS    = 1.
* Check General incompletion status of the header
    IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
      WRITE : 'SENT'.
    ENDIF.

  ELSE.
*    commit work.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 08:46:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310065#M1027452</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T08:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310066#M1027453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Answer is Definately Yes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please read the documentation of SO_NEW_DOCUMENT_SEND_API1 in se37 you will get your answer by your self.&lt;/P&gt;&lt;P&gt;Amit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 08:51:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310066#M1027453</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T08:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: SO_NEW_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310067#M1027454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Yes it is possiable.&lt;/P&gt;&lt;P&gt;see this example code&lt;/P&gt;&lt;P&gt;report zcl_testmail.&lt;/P&gt;&lt;P&gt;tables: ekko.&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 'Ur mail address'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of t_ekpo,&lt;/P&gt;&lt;P&gt;ebeln type ekpo-ebeln,&lt;/P&gt;&lt;P&gt;ebelp type ekpo-ebelp,&lt;/P&gt;&lt;P&gt;aedat type ekpo-aedat,&lt;/P&gt;&lt;P&gt;matnr type ekpo-matnr,&lt;/P&gt;&lt;P&gt;end of t_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_ekpo type standard table of t_ekpo initial size 0,&lt;/P&gt;&lt;P&gt;wa_ekpo type t_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of t_charekpo,&lt;/P&gt;&lt;P&gt;ebeln(10) type c,&lt;/P&gt;&lt;P&gt;ebelp(5) type c,&lt;/P&gt;&lt;P&gt;aedat(8) type c,&lt;/P&gt;&lt;P&gt;matnr(18) type c,&lt;/P&gt;&lt;P&gt;end of t_charekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_charekpo type t_charekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_message type standard table of solisti1 initial size 0&lt;/P&gt;&lt;P&gt;with header line.&lt;/P&gt;&lt;P&gt;data: it_attach type standard table of solisti1 initial size 0&lt;/P&gt;&lt;P&gt;with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: t_packing_list like sopcklsti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_contents like solisti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_receivers like somlreci1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_attachment like solisti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;t_object_header like solisti1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;w_cnt type i,&lt;/P&gt;&lt;P&gt;w_sent_all(1) type c,&lt;/P&gt;&lt;P&gt;w_doc_data like sodocchgi1,&lt;/P&gt;&lt;P&gt;gd_error type sy-subrc,&lt;/P&gt;&lt;P&gt;gd_reciever type sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*START_OF_SELECTION&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Retrieve sample data from table ekpo&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform data_retrieval.&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_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*END-OF-SELECTION&lt;/P&gt;&lt;P&gt;end-of-selection.&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;perform populate_email_message_body.&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_file_as_email_attachment&lt;/P&gt;&lt;P&gt;tables it_message&lt;/P&gt;&lt;P&gt;it_attach&lt;/P&gt;&lt;P&gt;using p_email&lt;/P&gt;&lt;P&gt;'Example .xls documnet attachment'&lt;/P&gt;&lt;P&gt;'XLS'&lt;/P&gt;&lt;P&gt;'filename'&lt;/P&gt;&lt;P&gt;' '&lt;/P&gt;&lt;P&gt;' '&lt;/P&gt;&lt;P&gt;' '&lt;/P&gt;&lt;P&gt;changing gd_error&lt;/P&gt;&lt;P&gt;gd_reciever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Instructs mail send program for SAPCONNECT to send email(rsconn01)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform initiate_mail_execute_program.&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 DATA_RETRIEVAL&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Retrieve data form EKPO table and populate itab it_ekko&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;form data_retrieval.&lt;/P&gt;&lt;P&gt;select ebeln ebelp aedat matnr&lt;/P&gt;&lt;P&gt;up to 10 rows&lt;/P&gt;&lt;P&gt;from ekpo&lt;/P&gt;&lt;P&gt;into table it_ekpo.&lt;/P&gt;&lt;P&gt;endform. " DATA_RETRIEVAL&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 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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build data table for .xls document&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;form build_xls_data_table.&lt;/P&gt;&lt;P&gt;constants: con_cret(20) type c value '0D', "OK for non Unicode&lt;/P&gt;&lt;P&gt;con_tab(20) type c 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;&lt;/P&gt;&lt;P&gt;concatenate 'EBELN' 'EBELP' 'AEDAT' 'MATNR'&lt;/P&gt;&lt;P&gt;into it_attach separated by con_tab.&lt;/P&gt;&lt;P&gt;concatenate con_cret it_attach into it_attach.&lt;/P&gt;&lt;P&gt;append it_attach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_ekpo into wa_charekpo.&lt;/P&gt;&lt;P&gt;concatenate wa_charekpo-ebeln wa_charekpo-ebelp&lt;/P&gt;&lt;P&gt;wa_charekpo-aedat wa_charekpo-matnr&lt;/P&gt;&lt;P&gt;into it_attach separated by con_tab.&lt;/P&gt;&lt;P&gt;concatenate con_cret it_attach into it_attach.&lt;/P&gt;&lt;P&gt;append it_attach.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endform. " BUILD_XLS_DATA_TABLE&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 SEND_FILE_AS_EMAIL_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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Send email&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;form send_file_as_email_attachment 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;p_sender_address&lt;/P&gt;&lt;P&gt;p_sender_addres_type&lt;/P&gt;&lt;P&gt;changing p_error&lt;/P&gt;&lt;P&gt;p_reciever.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: ld_error type sy-subrc,&lt;/P&gt;&lt;P&gt;ld_reciever type sy-subrc,&lt;/P&gt;&lt;P&gt;ld_mtitle like sodocchgi1-obj_descr,&lt;/P&gt;&lt;P&gt;ld_email like somlreci1-receiver,&lt;/P&gt;&lt;P&gt;ld_format type so_obj_tp ,&lt;/P&gt;&lt;P&gt;ld_attdescription type so_obj_nam ,&lt;/P&gt;&lt;P&gt;ld_attfilename type so_obj_des ,&lt;/P&gt;&lt;P&gt;ld_sender_address like soextreci1-receiver,&lt;/P&gt;&lt;P&gt;ld_sender_address_type like soextreci1-adr_typ,&lt;/P&gt;&lt;P&gt;ld_receiver like sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ld_email = p_email.&lt;/P&gt;&lt;P&gt;ld_mtitle = p_mtitle.&lt;/P&gt;&lt;P&gt;ld_format = p_format.&lt;/P&gt;&lt;P&gt;ld_attdescription = p_attdescription.&lt;/P&gt;&lt;P&gt;ld_attfilename = p_filename.&lt;/P&gt;&lt;P&gt;ld_sender_address = p_sender_address.&lt;/P&gt;&lt;P&gt;ld_sender_address_type = p_sender_addres_type.&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;Fill the document data.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;w_doc_data-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;w_doc_data-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_name = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_descr = ld_mtitle .&lt;/P&gt;&lt;P&gt;w_doc_data-sensitivty = 'F'.&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 w_doc_data.&lt;/P&gt;&lt;P&gt;read table it_attach index w_cnt.&lt;/P&gt;&lt;P&gt;w_doc_data-doc_size =&lt;/P&gt;&lt;P&gt;( w_cnt - 1 ) * 255 + strlen( it_attach ).&lt;/P&gt;&lt;P&gt;w_doc_data-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_name = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;w_doc_data-obj_descr = ld_mtitle.&lt;/P&gt;&lt;P&gt;w_doc_data-sensitivty = 'F'.&lt;/P&gt;&lt;P&gt;clear t_attachment.&lt;/P&gt;&lt;P&gt;refresh t_attachment.&lt;/P&gt;&lt;P&gt;t_attachment[] = 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 t_packing_list.&lt;/P&gt;&lt;P&gt;refresh t_packing_list.&lt;/P&gt;&lt;P&gt;t_packing_list-transf_bin = space.&lt;/P&gt;&lt;P&gt;t_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;t_packing_list-head_num = 0.&lt;/P&gt;&lt;P&gt;t_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;describe table it_message lines t_packing_list-body_num.&lt;/P&gt;&lt;P&gt;t_packing_list-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;append t_packing_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;t_packing_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;t_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;t_packing_list-head_num = 1.&lt;/P&gt;&lt;P&gt;t_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table t_attachment lines t_packing_list-body_num.&lt;/P&gt;&lt;P&gt;t_packing_list-doc_type = ld_format.&lt;/P&gt;&lt;P&gt;t_packing_list-obj_descr = ld_attdescription.&lt;/P&gt;&lt;P&gt;t_packing_list-obj_name = ld_attfilename.&lt;/P&gt;&lt;P&gt;t_packing_list-doc_size = t_packing_list-body_num * 255.&lt;/P&gt;&lt;P&gt;append t_packing_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 t_receivers.&lt;/P&gt;&lt;P&gt;refresh t_receivers.&lt;/P&gt;&lt;P&gt;t_receivers-receiver = ld_email.&lt;/P&gt;&lt;P&gt;t_receivers-rec_type = 'U'.&lt;/P&gt;&lt;P&gt;t_receivers-com_type = 'INT'.&lt;/P&gt;&lt;P&gt;t_receivers-notif_del = 'X'.&lt;/P&gt;&lt;P&gt;t_receivers-notif_ndel = 'X'.&lt;/P&gt;&lt;P&gt;append t_receivers.&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 = w_doc_data&lt;/P&gt;&lt;P&gt;put_in_outbox = 'X'&lt;/P&gt;&lt;P&gt;sender_address = ld_sender_address&lt;/P&gt;&lt;P&gt;sender_address_type = ld_sender_address_type&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 = w_sent_all&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;packing_list = t_packing_list&lt;/P&gt;&lt;P&gt;contents_bin = t_attachment&lt;/P&gt;&lt;P&gt;contents_txt = it_message&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate zerror return code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ld_error = sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate zreceiver return code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;loop at t_receivers.&lt;/P&gt;&lt;P&gt;ld_receiver = t_receivers-retrn_code.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endform.&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 INITIATE_MAIL_EXECUTE_PROGRAM&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Instructs mail send program for SAPCONNECT to send email.&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;form initiate_mail_execute_program.&lt;/P&gt;&lt;P&gt;wait up to 2 seconds.&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;endform. " INITIATE_MAIL_EXECUTE_PROGRAM&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 POPULATE_EMAIL_MESSAGE_BODY&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;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;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form populate_email_message_body.&lt;/P&gt;&lt;P&gt;refresh it_message.&lt;/P&gt;&lt;P&gt;it_message = 'Hi this is a test mail'.&lt;/P&gt;&lt;P&gt;append it_message.&lt;/P&gt;&lt;P&gt;Endform.&lt;/P&gt;&lt;P&gt;You can check the mail in &lt;STRONG&gt;sost&lt;/STRONG&gt; t-code.&lt;/P&gt;&lt;P&gt;hope it is helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2008 09:00:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/so-new-document-send-api1/m-p/4310067#M1027454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-04T09:00:57Z</dc:date>
    </item>
  </channel>
</rss>

