<?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: Pdf document not getting opened in mail in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-document-not-getting-opened-in-mail/m-p/6546500#M1428896</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check what is the sy-subrc value after the function module execution&lt;/P&gt;&lt;P&gt;SO_NEW_DOCUMENT_ATT_SEND_API1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess it should be 0 , if it is 0 then this is not an sap error..      &lt;/P&gt;&lt;P&gt;The pdf file is getting corrupted..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just try to send that mail to another person and try to open that in another system..&lt;/P&gt;&lt;P&gt;May be this can help you..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value of sy-subrc &amp;lt;&amp;gt; 0, then it is sap error.. just try to debugg and check if you can get any error or exception triggered..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish Boguda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Dec 2009 11:36:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-12-29T11:36:08Z</dc:date>
    <item>
      <title>Pdf document not getting opened in mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-document-not-getting-opened-in-mail/m-p/6546499#M1428895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created one pdf document from the spool request created&lt;/P&gt;&lt;P&gt;using function module &lt;STRONG&gt;CONVERT_ABAPSPOOLJOB_2_PDF&lt;/STRONG&gt; and&lt;/P&gt;&lt;P&gt;now i have to send this document in mail for that i have used the &lt;/P&gt;&lt;P&gt;function module &lt;STRONG&gt;SO_NEW_DOCUMENT_ATT_SEND_API1&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the document is getting recieved in the mail but while opening&lt;/P&gt;&lt;P&gt;it is giving an error *There was an error opening this document, the file is&lt;/P&gt;&lt;P&gt;damaged and could not be repaired*.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What should be done to open the pdf file in mail without being damaged.&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mansi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2009 11:30:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-document-not-getting-opened-in-mail/m-p/6546499#M1428895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-29T11:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Pdf document not getting opened in mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-document-not-getting-opened-in-mail/m-p/6546500#M1428896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check what is the sy-subrc value after the function module execution&lt;/P&gt;&lt;P&gt;SO_NEW_DOCUMENT_ATT_SEND_API1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess it should be 0 , if it is 0 then this is not an sap error..      &lt;/P&gt;&lt;P&gt;The pdf file is getting corrupted..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just try to send that mail to another person and try to open that in another system..&lt;/P&gt;&lt;P&gt;May be this can help you..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value of sy-subrc &amp;lt;&amp;gt; 0, then it is sap error.. just try to debugg and check if you can get any error or exception triggered..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish Boguda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2009 11:36:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-document-not-getting-opened-in-mail/m-p/6546500#M1428896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-29T11:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pdf document not getting opened in mail</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-document-not-getting-opened-in-mail/m-p/6546501#M1428897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="Code"&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;Attachment&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;Create Message Body Title and Description&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;Main Text&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;Attachment (pdf-Attachment)&lt;/LI&gt;&lt;LI level="1" type="ul"&gt; ELSE.&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;   CONCATENATE 'Mail Sent to' wa_eplant-email_add INTO lv_tt.&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;   MESSAGE lv_tt TYPE 'S' DISPLAY LIKE 'S'.&lt;/LI&gt;&lt;/UL&gt;
CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
     format                = 'PDF'
      max_linewidth         = 132
    IMPORTING
      bin_filesize          = v_len_in
    TABLES
      otf                   = i_otf
      lines                 = i_tline
    EXCEPTIONS
     err_max_linewidth     = 1
      err_format            = 2
      err_conv_not_possible = 3
      OTHERS                = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
  ENDIF.
  LOOP AT i_tline.
    TRANSLATE i_tline USING '~'.
    CONCATENATE wa_buffer i_tline INTO wa_buffer.
  ENDLOOP.
  TRANSLATE wa_buffer USING '~'.
  DO.
    i_record = wa_buffer.
    APPEND i_record.
    SHIFT wa_buffer LEFT BY 255 PLACES.
    IF wa_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.

  REFRESH: i_reclist,  i_objtxt,  i_objbin,  i_objpack.
  CLEAR wa_objhead.
  i_objbin[] = i_record[].


  i_objtxt =  text-011. "'Dear Sir/Madam,'."     '."'test with pdf-Attachment!'.
  APPEND i_objtxt.  
i_objtxt = text0. "'Please find the Inward Rejection Report as an PDF attachment'."     '."'test with pdf-Attachment!'.
  APPEND i_objtxt.
  i_objtxt = text-013. "'Warm Regards'."     '."'test with pdf-Attachment!'.
  APPEND i_objtxt.
 i_objtxt = wa_head-inspected_by."     '."'test with pdf-Attachment!'.
  APPEND i_objtxt.

  DESCRIBE TABLE i_objtxt LINES v_lines_txt.
 READ TABLE i_objtxt INDEX v_lines_txt.
  wa_doc_chng-obj_name = lv_t."'smartform'.
  wa_doc_chng-expiry_dat = sy-datum + 10.
  wa_doc_chng-obj_descr = lv_t." 'smartform'.
  wa_doc_chng-sensitivty = 'F'.
  wa_doc_chng-doc_size = v_lines_txt * 255.

  CLEAR i_objpack-transf_bin.
  i_objpack-head_start = 1.
  i_objpack-head_num = 0.
  i_objpack-body_start = 1.
  i_objpack-body_num = v_lines_txt.
  i_objpack-doc_type = 'RAW'.
  APPEND i_objpack.

  i_objpack-transf_bin = 'X'.
  i_objpack-head_start = 1.
  i_objpack-head_num = 0.
  i_objpack-body_start = 1.
  DESCRIBE TABLE i_objbin LINES v_lines_bin.
  READ TABLE i_objbin INDEX v_lines_bin.
 i_objpack-doc_size = v_lines_bin * 255 .
  i_objpack-body_num = v_lines_bin.
  i_objpack-doc_type = 'PDF'.
  i_objpack-obj_name = 'smart'.
  i_objpack-obj_descr = lv_t ."'test'.
  APPEND i_objpack.

  REFRESH  i_reclist.
  LOOP AT it_email INTO wa_email.
    w_reclist-receiver = wa_email-smtp_addr.
    w_reclist-rec_type = 'U'.
    APPEND w_reclist TO i_reclist.
  ENDLOOP.




  LOOP AT it_eplant INTO wa_eplant.
    w_reclist-receiver = wa_eplant-email_add.
    w_reclist-rec_type = 'U'.
    IF wa_eplant-cc1 = 'X'.
      w_reclist-copy = 'X'.
    ENDIF.

    IF wa_eplant-bcc = 'X'.
      w_reclist-blind_copy = 'X'.
   ENDIF.
   APPEND w_reclist TO i_reclist.
  CLEAR w_reclist.
  ENDLOOP.

  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = wa_doc_chng
      put_in_outbox              = 'X'
      commit_work                = 'X'
    TABLES
      packing_list               = i_objpack
      object_header              = wa_objhead
      contents_bin               = i_objbin
      contents_txt               = i_objtxt
      receivers                  = i_reclist
    .
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE 'Error When Sending the File' TYPE 'E' DISPLAY LIKE 'S'.



  ENDIF.
&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rasheed salman on Dec 30, 2009 6:03 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2009 04:58:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-document-not-getting-opened-in-mail/m-p/6546501#M1428897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-12-30T04:58:46Z</dc:date>
    </item>
  </channel>
</rss>

