<?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: Problem while sending attachment thru 'SO_DOCUMENT_SEND_API1' in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383977#M1643098</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;At first look, you seem to describe two times the body of your message in it_packing_list. I guess one time is enough...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Nov 2011 16:11:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-11-09T16:11:18Z</dc:date>
    <item>
      <title>Problem while sending attachment thru 'SO_DOCUMENT_SEND_API1'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383973#M1643094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to send two excel files thrugh the function module 'SO_DOCUMENT_SEND_API1' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attachments are reaching the destination email address successfully , But along with two attacments its sending one more .txt  file also in which email body text is included .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me to resolve the issue  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 14:43:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383973#M1643094</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-09T14:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem while sending attachment thru 'SO_DOCUMENT_SEND_API1'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383974#M1643095</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;This is probably due to wrong setting in SCOT...&lt;/P&gt;&lt;P&gt;PLease follow this link to check this: &lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1263306"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this doesn't solve your issue, drop some code over here so we can help you more easily... The problem then surely comes from your FM parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 15:05:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383974#M1643095</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-09T15:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Problem while sending attachment thru 'SO_DOCUMENT_SEND_API1'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383975#M1643096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manu ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked with setting and everything is as expected .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attaching the code which I have used in my program for sending 2 excel , Please help .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; gd_doc_data-doc_size = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Fill the document data for attachment 2&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;  READ TABLE it_attach INDEX gd_cnt.&lt;/P&gt;&lt;P&gt;  gd_doc_data-doc_size =&lt;/P&gt;&lt;P&gt;      ( gd_cnt - 1 ) * 255 + STRLEN( it_attach ).&lt;/P&gt;&lt;P&gt;  gd_doc_data-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;  gd_doc_data-obj_name  = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;  gd_doc_data-obj_descr = psubject.&lt;/P&gt;&lt;P&gt;  gd_doc_data-sensitivty = 'F'.&lt;/P&gt;&lt;P&gt;  CLEAR it_attachment.&lt;/P&gt;&lt;P&gt;  REFRESH it_attachment.&lt;/P&gt;&lt;P&gt;  it_attachment[] = it_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 it_packing_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  REFRESH it_packing_list.&lt;/P&gt;&lt;P&gt;  it_packing_list-transf_bin = space.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_num = 0.&lt;/P&gt;&lt;P&gt;  it_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE it_message LINES it_packing_list-body_num.&lt;/P&gt;&lt;P&gt;  it_packing_list-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;  APPEND it_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;  it_packing_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_num   = 1.&lt;/P&gt;&lt;P&gt;  it_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.&lt;/P&gt;&lt;P&gt;  it_packing_list-doc_type   =  'XLS'.&lt;/P&gt;&lt;P&gt;  it_packing_list-obj_descr  =  'Successful Ser.no'.&lt;/P&gt;&lt;P&gt;  it_packing_list-obj_name   =  'Allot'.&lt;/P&gt;&lt;P&gt;  it_packing_list-doc_size   =  it_packing_list-body_num * 255.&lt;/P&gt;&lt;P&gt;  APPEND it_packing_list.&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 attachment 2&lt;/P&gt;&lt;/LI&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;  READ TABLE it_attach_1 INDEX gd_cnt.&lt;/P&gt;&lt;P&gt;  gd_doc_data-doc_size =&lt;/P&gt;&lt;P&gt;      ( gd_cnt - 1 ) * 255 + STRLEN( it_attach_1 ).&lt;/P&gt;&lt;P&gt;  gd_doc_data-obj_langu = sy-langu.&lt;/P&gt;&lt;P&gt;  gd_doc_data-obj_name  = 'SAPRPT'.&lt;/P&gt;&lt;P&gt;  gd_doc_data-obj_descr = psubject.&lt;/P&gt;&lt;P&gt;  gd_doc_data-sensitivty = 'F'.&lt;/P&gt;&lt;P&gt;  CLEAR it_attachment.&lt;/P&gt;&lt;P&gt;  REFRESH it_attachment.&lt;/P&gt;&lt;P&gt;  it_attachment[] = it_attach_1[].&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;LI level="1" type="ul"&gt;&lt;P&gt; CLEAR it_packing_list.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; REFRESH it_packing_list.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  it_packing_list-transf_bin = space.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_num = 0.&lt;/P&gt;&lt;P&gt;  it_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE it_message LINES it_packing_list-body_num.&lt;/P&gt;&lt;P&gt;  it_packing_list-doc_type = 'RAW'.&lt;/P&gt;&lt;P&gt;  APPEND it_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;  it_packing_list-transf_bin = 'X'.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_start = 1.&lt;/P&gt;&lt;P&gt;  it_packing_list-head_num   = 1.&lt;/P&gt;&lt;P&gt;  it_packing_list-body_start = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.&lt;/P&gt;&lt;P&gt;  it_packing_list-doc_type   =  'XLS'.&lt;/P&gt;&lt;P&gt;  it_packing_list-obj_descr  =  'Unsuccessful Ser.no'.&lt;/P&gt;&lt;P&gt;  it_packing_list-obj_name   =  'Allot1'.&lt;/P&gt;&lt;P&gt;  it_packing_list-doc_size   =  it_packing_list-body_num * 255.&lt;/P&gt;&lt;P&gt;  APPEND it_packing_list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call the FM to post the message to SAPMAIL&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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              = gd_doc_data&lt;/P&gt;&lt;P&gt;            put_in_outbox              = 'X'&lt;/P&gt;&lt;P&gt;            sender_address             = 'Traking System'&lt;/P&gt;&lt;P&gt;            sender_address_type        = 'INT'&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                = gd_sent_all&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            packing_list               = it_packing_list&lt;/P&gt;&lt;P&gt;            contents_bin               = it_attachment&lt;/P&gt;&lt;P&gt;            contents_txt               = it_message&lt;/P&gt;&lt;P&gt;            receivers                  = it_receivers&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            too_many_receivers         = 1&lt;/P&gt;&lt;P&gt;            document_not_sent          = 2&lt;/P&gt;&lt;P&gt;            document_type_not_exist    = 3&lt;/P&gt;&lt;P&gt;            operation_no_authorization = 4&lt;/P&gt;&lt;P&gt;            parameter_error            = 5&lt;/P&gt;&lt;P&gt;            x_error                    = 6&lt;/P&gt;&lt;P&gt;            enqueue_error              = 7&lt;/P&gt;&lt;P&gt;            OTHERS                     = 8.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 15:54:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383975#M1643096</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-09T15:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Problem while sending attachment thru 'SO_DOCUMENT_SEND_API1'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383976#M1643097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Compare with this code that works without issues. You need to append the packing list only two times one for doc_type = RAW and one for doc_type = XLS. I see that you are appending it 3 times, which may be the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*Populating the body
  lv_message = l_c_mess_1 .
  APPEND lv_message TO gt_message.

  lv_message = space.
  APPEND lv_message TO gt_message.

  CONCATENATE l_c_mess_5 p_fname '.' INTO lv_message SEPARATED BY space.
  APPEND lv_message TO gt_message.

  lv_message = space.
  APPEND lv_message TO gt_message.

  lv_message = l_c_mess_6.
  APPEND lv_message TO gt_message.

  lv_message = space.
  APPEND lv_message TO gt_message.

  lv_message = l_c_mess_7.
  APPEND lv_message TO gt_message.

  lv_message = space.
  APPEND lv_message TO gt_message.

  lv_message = l_c_mess_8.
  APPEND lv_message TO gt_message.

* Populate attachment
    LOOP AT gt_error INTO gs_error.
      CONCATENATE gs_error-client_id gs_error-client_run_id
                  gs_error-vendor_id
                  gs_error-row_id gs_error-carrier_vendor_code
                  gs_error-carrier_id
                  gs_error-invoice_number
                  gs_error-msg
               INTO gs_attachment SEPARATED BY gc_tab.
      gs_attachment+253(2) = '##'.
      REPLACE '##' WITH l_c_newline INTO gs_attachment.
      APPEND gs_attachment TO gt_attachment.
    ENDLOOP.

**File Type
  ld_format = 'XLS'.
**File Name
  IF NOT gt_error[] IS INITIAL.
    CONCATENATE 'Error Report' sy-datum sy-sysid sy-uname
      INTO ld_attfilename SEPARATED BY space.
  ELSE.
    CONCATENATE 'Success Report' sy-datum sy-sysid sy-uname
      INTO ld_attfilename SEPARATED BY space.
  ENDIF.

* Fill the document data and get size of attachment
  CLEAR gd_doc_data.

* Populate the subject/generic message attributes
  gd_doc_data-obj_langu = sy-langu.
  gd_doc_data-doc_size = 1.
  gd_doc_data-obj_name = 'SAPRPT'.
  IF NOT gt_error[] IS INITIAL.
    gd_doc_data-obj_descr = gv_err_subject.
  ELSE.
    gd_doc_data-obj_descr = gv_suc_subject.
  ENDIF.
  gd_doc_data-sensitivty = 'F'.

* Describe the body of the message
  CLEAR gt_packing_list.
  REFRESH gt_packing_list.
  gs_packing_list-transf_bin = space.
  gs_packing_list-head_start = 1.
  gs_packing_list-head_num = 0.
  gs_packing_list-body_start = 1.
  DESCRIBE TABLE gt_message LINES gs_packing_list-body_num.
  gs_packing_list-doc_type = 'RAW'.
  APPEND gs_packing_list TO gt_packing_list.
  CLEAR gs_packing_list.

*Describe the attachment info
  gs_packing_list-transf_bin = 'X'.
  gs_packing_list-head_start = 1.
  gs_packing_list-head_num = 1.
  gs_packing_list-body_start = 1.
  DESCRIBE TABLE gt_attachment LINES gs_packing_list-body_num.
  gs_packing_list-doc_type = ld_format.
  gs_packing_list-obj_name = ld_attfilename.
  gs_packing_list-obj_descr = ld_attfilename.
  gs_packing_list-doc_size = gs_packing_list-body_num * 255.
  APPEND gs_packing_list TO gt_packing_list.

**Populating Mail Recepients
  gs_receivers-receiver = p_email.
  gs_receivers-rec_type = 'C'.
  gs_receivers-com_type = 'INT'.
  gs_receivers-notif_del = 'X'.
  gs_receivers-notif_ndel = 'X'.
  gs_receivers-express = 'X'.
  APPEND gs_receivers TO gt_receivers.

*Function Module to send mail
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
       EXPORTING
            document_data              = gd_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
       TABLES
            packing_list               = gt_packing_list
            contents_bin               = gt_attachment
            contents_txt               = gt_message
            receivers                  = gt_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 sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE e024.
  ENDIF.

*Executing the standard mail sending program for immediate dispatch of
*mail
  SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 16:09:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383976#M1643097</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-09T16:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Problem while sending attachment thru 'SO_DOCUMENT_SEND_API1'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383977#M1643098</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;At first look, you seem to describe two times the body of your message in it_packing_list. I guess one time is enough...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kr,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 16:11:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383977#M1643098</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-09T16:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem while sending attachment thru 'SO_DOCUMENT_SEND_API1'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383978#M1643099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manu  ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks alot   ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Issue got resolved , Message body was described 2 times  .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nusrat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 16:20:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-while-sending-attachment-thru-so-document-send-api1/m-p/8383978#M1643099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-09T16:20:35Z</dc:date>
    </item>
  </channel>
</rss>

