cancel
Showing results for 
Search instead for 
Did you mean: 

problem with file download or eMail attachment

0 Kudos

Hi Community,

I'm working on my first PDF printout form (not interactive). Creating a spool job and printing on a printer in background works fine, but i have some trouble creating pdf-Files to store on my system or to attach to an eMail.

In both scenarios, the pdf document is created, but empty. It is not possible to open the document, an error message appears in the adobe reader "File-type not supported or file is damaged".

I use the function download_file from the FP_UTILITIES Include.

After that I tried to create an eMail with the pdf-file attached. I used a Link: [SDN documentation|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d?quicklink=index&overridelayout=true] to implement this. The coding works and I receive an eMail with the pdf-Attachment, but again, I am not able to open the file due to the error message described above.

Thanks in advance

Ralf

Here is the main coding for this issue:


CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = gs_outputpar
    EXCEPTIONS
      cancel          = 1
      usage_error     = 2
      system_error    = 3
      internal_error  = 4
      OTHERS          = 5.
  IF sy-subrc <> 0.
*   error handling
    PERFORM protocol_update USING screen_output.
  ENDIF.

  CALL FUNCTION lf_fm_name
  EXPORTING
    /1bcdwb/docparams   = gs_docparams
    label_data          = label_data_pdf
    zzuinf              = g_zuinf
  IMPORTING
    /1BCDBWB/FORMOUTPUT = gs_formoutput "
  EXCEPTIONS
      usage_error     = 1
      system_error    = 2
      internal_error  = 3
      OTHERS          = 4.
  IF sy-subrc <> 0.
*   error handling
    PERFORM protocol_update USING screen_output.
  ENDIF.

CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
*    E_RESULT  =          
EXCEPTIONS
      usage_error     = 1
      system_error    = 2
      internal_error  = 3
      OTHERS          = 4.
  IF sy-subrc <> 0.
*   error handling
    PERFORM protocol_update USING screen_output.
  ENDIF.
DATA: lt_att_content_hex TYPE SOLIX_TAB.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
  EXPORTING
    buffer      = gs_formoutput-PDF    
  TABLES
    binary_tab  = lt_att_content_hex.

Accepted Solutions (1)

Accepted Solutions (1)

OttoGold
Active Contributor
0 Kudos

It is a stupid question, but do you have Adobe Reader installed? What version? Otto

Answers (1)

Answers (1)

0 Kudos

Hi Otto,

yes, Adobe reader is installed. Version 8.1.2.

If I use the same coding and create a spool job, i can open the preview in adobe reader without any problem.

Do you know if there might be any problem within the ADS configuration?

Regards

Ralf

0 Kudos

I fixed the issue by myself.

i had an error in my coding:

instead of


CALL FUNCTION lf_fm_name
  EXPORTING
    /1bcdwb/docparams   = gs_docparams
    label_data          = label_data_pdf
    zzuinf              = g_zuinf
  IMPORTING
    /1BCDWB/FORMOUTPUT = gs_formoutput

i wrote

/1BCD B WB/FORMOUTPUT

Now, everything works fine!

Regards

Ralf

Edited by: Ralf Dillenburger on Mar 12, 2010 2:05 PM