<?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: Error in PDF attachment send by  SO_DOCUMENT_SEND_API1 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270137#M1386517</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi: &lt;/P&gt;&lt;P&gt;The code you pasted in the question seems correct. &lt;/P&gt;&lt;P&gt;¿Can you paste complete code?, may be the problem is located in some other lines&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Jordi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Nov 2009 10:08:22 GMT</pubDate>
    <dc:creator>jordi_escodaruiz</dc:creator>
    <dc:date>2009-11-03T10:08:22Z</dc:date>
    <item>
      <title>Error in PDF attachment send by  SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270136#M1386516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to send an email with PDF attachment. The PDF file is stored on SAP server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use READ DATASET FOR INPUT IN BINARY MODE in order to get PDF content.&lt;/P&gt;&lt;P&gt;I fill a table T_DATA with content (T_DATA : STANDARD  TABLE OF XSTRING)   =&amp;gt; T_DATA contains only 1 line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I convert XSTRING in BINARY with function SCMS_XSTRING_TO_BINARY =&amp;gt; fill T_DATA_CHAR (type table of solisti1)&lt;/P&gt;&lt;P&gt;          &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = s_data        =&amp;gt; first LINE of T_DATA
           IMPORTING
             output_length         = w_output_length
            TABLES
              binary_tab            =  t_data_char.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I fill tables for 'SO_DOCUMENT_SEND_API1'. &lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND LINES OF t_data_char TO t_contents_bin.
            s_packing_list-transf_bin = 'X'.
            s_packing_list-head_start = 1.
            s_packing_list-head_num   = w_cpt.
            s_packing_list-body_start = 1.
            DESCRIBE TABLE t_data_char  LINES s_packing_list-body_num.
            s_packing_list-doc_type   = 'PDF'.
...
            s_packing_list-doc_size  = w_output_length.
            APPEND s_packing_list TO t_packing_list.
....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The mail is well created but i can't open the PDF attachment because I have the message "There was error in opening. File damaged &amp;amp; could not be repaired".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can I do ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 09:49:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270136#M1386516</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T09:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error in PDF attachment send by  SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270137#M1386517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi: &lt;/P&gt;&lt;P&gt;The code you pasted in the question seems correct. &lt;/P&gt;&lt;P&gt;¿Can you paste complete code?, may be the problem is located in some other lines&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Jordi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 10:08:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270137#M1386517</guid>
      <dc:creator>jordi_escodaruiz</dc:creator>
      <dc:date>2009-11-03T10:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error in PDF attachment send by  SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270138#M1386518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Complete code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*       Title
        CLEAR w_document_data.
        CONCATENATE text-001 i_belnr
        INTO w_document_data-obj_descr
        SEPARATED BY space.
        w_document_data-sensitivty = 'F'.
        w_document_data-obj_langu = sy-langu.
        w_document_data-no_change = 'X' .
        w_document_data-expiry_dat = sy-datum + 30.

*       Mail content
        CLEAR s_packing_list.
        s_packing_list-transf_bin = space.
        s_packing_list-head_start = 1.
        s_packing_list-head_num = 0.
        s_packing_list-body_start = 1.
        DESCRIBE TABLE  t_corps_mail LINES s_packing_list-body_num.
        s_packing_list-doc_type = 'RAW'.
        APPEND s_packing_list TO    t_packing_list


OPEN DATASET w_path
                FOR INPUT
                IN BINARY MODE
                MESSAGE msg.

          IF sy-subrc = 0.
    DO.
              CLEAR s_data.
              READ DATASET w_path INTO s_data.
              IF sy-subrc &amp;lt;&amp;gt; 0.
                EXIT.
              ENDIF.
              APPEND s_data TO t_data.
            ENDDO.
          ENDIF.
          CLOSE DATASET w_path.
        READ TABLE t_data INTO s_data INDEX 1.

        DATA : w_output_length TYPE i.
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = s_data
           IMPORTING
             output_length         = w_output_length
            TABLES
              binary_tab            =  t_data_char

          IF sy-subrc = 0.

            APPEND LINES OF t_data_char TO t_contents_bin.

            s_packing_list-transf_bin = 'X'.
            s_packing_list-head_start = 1.
            s_packing_list-head_num   = 1.
            s_packing_list-body_start = 1.

            DESCRIBE TABLE t_data_char
            LINES s_packing_list-body_num.
            s_packing_list-doc_type   =  k_type_pdf.
            s_packing_list-obj_name = 'NAME'.
           s_packing_list-obj_descr = 'DESC'.
           s_packing_list-doc_size  = w_output_length.
          APPEND s_packing_list TO t_packing_list.

        CLEAR s_receivers.
        s_receivers-receiver = w_receiver.
        s_receivers-rec_type = 'U'.
        APPEND s_receivers TO t_receivers.

        CALL FUNCTION 'SO_DOCUMENT_SEND_API1' 
        EXPORTING
          document_data              = w_document_data
          sender_address            =  w_sender  
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = t_packing_list
          contents_bin               = t_contents_bin     
          contents_txt               = t_corps_mail
          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 sy-subrc = 0.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Laure VERE on Nov 3, 2009 11:22 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Laure VERE on Nov 3, 2009 11:22 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 10:22:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270138#M1386518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T10:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error in PDF attachment send by  SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270139#M1386519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Buff&lt;/P&gt;&lt;P&gt;The code is unreadable in the forum...&lt;/P&gt;&lt;P&gt;Fortunately I can see it in the mail I received.&lt;/P&gt;&lt;P&gt;I don't see anything wrong. It's strange.&lt;/P&gt;&lt;P&gt;I assume that the constant k_type_pdf has the value 'PDF' &lt;/P&gt;&lt;P&gt;Sorry but I don't have more ideas.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jordi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 11:24:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270139#M1386519</guid>
      <dc:creator>jordi_escodaruiz</dc:creator>
      <dc:date>2009-11-03T11:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Error in PDF attachment send by  SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270140#M1386520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;although your code seems to be correct but still i will suggest you to go by the OOPs method. below is the code which i wrote and its working perfectly fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Convert PDF Object to type SOLIX
  CALL METHOD cl_document_bcs=&amp;gt;xstring_to_solix
    EXPORTING
      ip_xstring = wa_pdfobject-pdf
    RECEIVING
      rt_solix   = it_attachment.

* Initialize Mail creation
  TRY.
      obj_send_request = cl_bcs=&amp;gt;create_persistent( ).

* Set sender Email address
      obj_sender =
      cl_cam_address_bcs=&amp;gt;create_internet_address( lc_id_from ).
      obj_send_request-&amp;gt;set_sender( i_sender = obj_sender ).

* Get Recipient's Email IDs
     obj_recipient =
           cl_cam_address_bcs=&amp;gt;create_internet_address( lv_recv_id ).
      obj_send_request-&amp;gt;add_recipient(
      i_recipient = obj_recipient
      i_express = c_x
      ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
      " create documents
      obj_document = cl_document_bcs=&amp;gt;create_document(
      i_type = lc_type_raw " RAW document format
      i_text = it_contents
      i_subject = lv_subject
      ).
      obj_document-&amp;gt;add_attachment(
      i_attachment_type = lc_type_pdf " add PDF attachment
      i_attachment_subject = Subject'
      i_att_content_hex = it_attachment
      ).
      obj_send_request-&amp;gt;set_document( obj_document ).
**********************************************************************
      " send email
      obj_send_request-&amp;gt;set_send_immediately( c_x ).
      lv_ret = obj_send_request-&amp;gt;send( ).                
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ags.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 11:50:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270140#M1386520</guid>
      <dc:creator>agnihotro_sinha2</dc:creator>
      <dc:date>2009-11-03T11:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error in PDF attachment send by  SO_DOCUMENT_SEND_API1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270141#M1386521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll try to use the OOPs method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Laure VERE on Nov 3, 2009 1:45 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Laure VERE on Nov 3, 2009 1:45 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Nov 2009 12:44:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-pdf-attachment-send-by-so-document-send-api1/m-p/6270141#M1386521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-03T12:44:38Z</dc:date>
    </item>
  </channel>
</rss>

