<?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 Attachment could not be opened! in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315960#M1536216</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could be 'anything'. You are not providing any relevant information one can use to help you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Is there an error message when opening? If so, what error message?&lt;/P&gt;&lt;P&gt;2. Are you able to sent it to an external mail address and open it?&lt;/P&gt;&lt;P&gt;3. etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do agree, that is probably has something to do with conversion. But since not even an extract of your coding is provided, we won't be able to help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Sep 2010 15:29:05 GMT</pubDate>
    <dc:creator>Sm1tje</dc:creator>
    <dc:date>2010-09-17T15:29:05Z</dc:date>
    <item>
      <title>PDF Attachment could not be opened!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315959#M1536215</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've got a problem with the conversion of pdf documents in the business workflow.&lt;/P&gt;&lt;P&gt;I wrote a program where the user can choose a pdf document from his computer.&lt;/P&gt;&lt;P&gt;In another parameter he write the sap username of somebody. The program sends the sapmail to this written user.&lt;/P&gt;&lt;P&gt;The Parameter p_trans is only for the information in the text of the mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the documents could not be opened...i think it's a problem with the conversion.&lt;/P&gt;&lt;P&gt;Or are there any &lt;STRONG&gt;settings&lt;/STRONG&gt; in the sap i have to do?&lt;/P&gt;&lt;P&gt;Because a friend i know, can open pdf's documents with my programm. &lt;/P&gt;&lt;P&gt;But i have no idea where my fault is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do it with &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;open_file_dialog&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;gui_upload&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and &lt;STRONG&gt;BCS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe somebody can help me!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings &lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Sep 2010 07:09:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315959#M1536215</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-17T07:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: PDF Attachment could not be opened!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315960#M1536216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could be 'anything'. You are not providing any relevant information one can use to help you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Is there an error message when opening? If so, what error message?&lt;/P&gt;&lt;P&gt;2. Are you able to sent it to an external mail address and open it?&lt;/P&gt;&lt;P&gt;3. etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do agree, that is probably has something to do with conversion. But since not even an extract of your coding is provided, we won't be able to help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Sep 2010 15:29:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315960#M1536216</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2010-09-17T15:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: PDF Attachment could not be opened!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315961#M1536217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes i know.&lt;/P&gt;&lt;P&gt;that's my first time here. i'm sorry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no error! Everthing works.&lt;/P&gt;&lt;P&gt;But when i want to open the pdf document, acrobat reader says that it cannot open it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And it's the same problem when i send the mail with the attachment to an external mail.&lt;/P&gt;&lt;P&gt;Everything is fine, but i can not open the pdf file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are extracts of my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: t_file TYPE c LENGTH 1024.
TYPES: tt_file_content TYPE soli_tab.
DATA: gt_file_content TYPE tt_file_content.
PARAMETERS: p_file  TYPE t_file OBLIGATORY LOWER CASE.
PARAMETERS: p_recpt TYPE uname.
PARAMETERS: p_trans(15) TYPE c OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  PERFORM select_file CHANGING p_file.

START-OF-SELECTION.

  PERFORM get_file USING p_file
                   CHANGING gt_file_content.

  PERFORM send_mail USING gt_file_content
                          p_file
                          p_recpt.
  COMMIT WORK. 

FORM select_file CHANGING p_file TYPE t_file.
  DATA: l_rc    TYPE sy-subrc,
        lt_file TYPE filetable.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Choose the file:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD cl_gui_frontend_services=&amp;gt;file_open_dialog
    EXPORTING
       window_title            = 'Datei auswählen'
*      default_extension       =
       default_filename        = '*.pdf'
*      file_filter             =
*      with_encoding           =
*      initial_directory       =
*      multiselection          =
   CHANGING
     file_table              = lt_file
     rc                      = l_rc
*      user_action             =
*      file_encoding           =
   EXCEPTIONS
     file_open_dialog_failed = 1
     cntl_error              = 2
     error_no_gui            = 3
     not_supported_by_gui    = 4
     OTHERS  .
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE 'Fehler bei der Dateiauswahl' TYPE 'W'.
  ELSE.
    READ TABLE lt_file INTO p_file INDEX 1.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Upload:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD cl_gui_frontend_services=&amp;gt;gui_upload
    EXPORTING
      filename                = l_file
      filetype                = 'BIN'
      has_field_separator     = space
      header_length           = 0
      read_by_line            = 'X'
      dat_mode                = space
      codepage                = space
      ignore_cerr             = abap_true
      replacement             = '#'
*      virus_scan_profile      =
*    IMPORTING
*      filelength              =
*      header                  =
    CHANGING
      data_tab                = pt_file_content.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRY.
      lr_send_request = cl_bcs=&amp;gt;create_persistent( ).
    CATCH cx_send_req_bcs INTO lr_cx_send_req_bcs.
      MESSAGE 'document_creat_error' TYPE 'E'.
  ENDTRY. 

TRY.
      lr_document = cl_document_bcs=&amp;gt;create_document(
                      i_type    = 'RAW'       " SAP Dokument
                      i_text    = lt_mailtext[]
                      i_subject = l_subject ).
    CATCH cx_document_bcs INTO lr_cx_document_bcs.
      MESSAGE 'document_error' TYPE 'E'.
  ENDTRY. 

  TRY.
*     Splitten des Pfades
      SPLIT p_file AT '' INTO TABLE lt_split.
      l_index = LINES( lt_split ).
      READ TABLE lt_split INTO l_subject INDEX l_index.
      CLEAR lt_split.
      SPLIT l_subject AT '.' INTO TABLE lt_split.
      READ TABLE lt_split INTO l_attachment_subject INDEX 1.
      READ TABLE lt_split INTO l_attachment_type INDEX 2.

      CALL METHOD lr_document-&amp;gt;add_attachment
        EXPORTING
          i_attachment_type    = l_attachment_type
          i_attachment_subject = l_attachment_subject
          i_att_content_text   = pt_file_content.
    CATCH cx_document_bcs .
      MESSAGE 'add_attachment' TYPE 'E'.
  ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     The text in the mail i only append like this here:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;APPEND text-001 TO lt_mailtext.
  APPEND text-002 TO lt_mailtext.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     In the other parts i say...that it has to send the mail to the sap user, and it has to be an express mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the end is send everything with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRY.
      CALL METHOD lr_send_request-&amp;gt;send
        RECEIVING
          result = l_sent_to_all.
    CATCH cx_send_req_bcs INTO lr_cx_send_req_bcs.
      MESSAGE 'Senden fehlgeschlagen' TYPE 'E'.
  ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't  post the declarations and parameters.&lt;/P&gt;&lt;P&gt;Maybe you need one,  for sure i will post it.&lt;/P&gt;&lt;P&gt;But i think, the post will be to big with declarations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Marcel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Sep 2010 17:49:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315961#M1536217</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-17T17:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: PDF Attachment could not be opened!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315962#M1536218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The PDF file contents are in binary format so you need to use the binary attachment option - it looks like you are using the text format:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  DATA: LT_PDFBIN        TYPE SOLIX_TAB.
...

      LR_DOCUMENT-&amp;gt;ADD_ATTACHMENT( I_ATTACHMENT_TYPE    = 'PDF'
                                   I_ATTACHMENT_SUBJECT = FILENAME
                                   I_ATT_CONTENT_HEX    = LT_PDFBIN ).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Sep 2010 18:15:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315962#M1536218</guid>
      <dc:creator>brad_bohn</dc:creator>
      <dc:date>2010-09-17T18:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: PDF Attachment could not be opened!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315963#M1536219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will check it on Monday.&lt;/P&gt;&lt;P&gt;Maybe that's the solution, i hope &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and i will know you if that was my fault.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Sep 2010 21:48:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315963#M1536219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-17T21:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: PDF Attachment could not be opened!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315964#M1536220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IT WORKS!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another question, it's not so important, but do you know what i've to do, that i can upload also word or excel documents?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks a lot Brad!!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Sep 2010 05:47:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pdf-attachment-could-not-be-opened/m-p/7315964#M1536220</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-20T05:47:49Z</dc:date>
    </item>
  </channel>
</rss>

