Skip to Content
avatar image
Former Member

Error while opening PDF in mail attachment

Hi All,

In smartform i am sending a mail with attachemnt as PDF file,there is one more option like preview of smartform .

issue is like i am able to see the preview of the same record but when it is sent in mail attachement,and while opening PDF its showing error that file can not be open it is corrupted.

Please help.

Mona Singh.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Dec 09, 2009 at 10:17 AM

    Hello. I have exactly the same problem. I return the OTF data from the Smartform and call the function CONVERT_OTF.

    If I now do a GUI_DOWNLOAD, I can open the PDF file as expected, but when I send the file as an attachment in an e-mail (using f.m. SO_NEW_DOCUMENT_ATT_SEND_API1) I cannot open the PDF file. Instead it gives an error message, " cannot open file, file is damaged". I have attached the function module that I call directly after calling the smartform. Can anybody help? I am using a ECC 6.0 System, Basis SP level 19 but had the same problem on v 4.7.

    I tried to attach the code (I have tried with several sample programs provided on this forum), but it doesn't format correctly. Can someone give me a tip how to stop program code displaying in continuous text.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Dear Sandra

      That was my problem: binary data was incorrectly converted (often because of Unicode systems).

      I returned

      bin_filesize = v_len_in

      bin_file = l_binfile

      from the function module CONVERT_OTF, then converted the xstring data (l_binfile) into an internal table (t_objbin) to send to the mail send function with the following function module:

          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer        = l_binfile
            IMPORTING
              output_length = v_lines_bin
            TABLES
              binary_tab    = t_objbin.
      

      Many thanks for your help.

      Best regards

      Patricia