Skip to Content
author's profile photo Former Member
Former Member

Save Generated PDF to desktop

Hi Experts

I have a program that needs to generate a form and save it to the local hard drive.

I use the following functions for populating the form:

CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
            EXPORTING
              i_name     ='ZSFPFLS_EX_WDA_CON'
            IMPORTING
              e_funcname = fm_name.

*   Set output parameters and open spool job
  fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
  fp_outputparams-getpdf = 'X'. " launch print preview
  fp_outputparams-PDFCHANGESRESTRICTED = 'N'. "Form can be filled out and signed and you can also create comments

  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = fp_outputparams
    EXCEPTIONS
      cancel          = 1
      usage_error     = 2
      system_error    = 3
      internal_error  = 4
      OTHERS          = 5.

*   Set form language and country (->form locale)
  fp_docparams-langu   = 'E'.
  fp_docparams-country = 'ZA'.
  fp_docparams-dynamic = 'X'.


*   Now call the generated function module
  CALL FUNCTION fm_name
    EXPORTING
      /1bcdwb/docparams       = fp_docparams
      SCHEDULE                = ls_pdf_sched
      ADDITIONAL_INFO         = ls_convocation-additional_info
      ISSUE_DATE              = ls_convocation-issue_date
...
    IMPORTING
      /1bcdwb/formoutput      = fp_formoutput
    EXCEPTIONS
      usage_error             = 1
      system_error            = 2
      internal_error          = 3
      OTHERS                  = 4.

*   Close spool job
  CALL FUNCTION 'FP_JOB_CLOSE'
    EXCEPTIONS
      usage_error    = 1
      system_error   = 2
      internal_error = 3
      OTHERS         = 4.

*   Now you have the PDF form in xstring format inside the field fp_formoutput-pdf

  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer = fp_formoutput-pdf
    TABLES
      binary_tab = itab.

I then want to use the following method for selecting the location where to save the file:

CALL METHOD cl_gui_frontend_services=>file_save_dialog
...

What do I now need to do to actually save the file to that location?

Thanks in advance

Anton Kruse

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Nov 10, 2009 at 09:11 AM

    Decide, whether you want to use this ABAP coding, or it is cleaner/ better/ proper to display the form to the user and let him save it. I recommend this:

    Use outputparams to set up the preview every time. Then the form will be displayed with no additional clicks and waiting to the user, And he can check it first and save it using "save" in adobe reader.

    Of course you could do this using ABAP, but why would you do this? (except some FTP silent save crazy function:))). And that I would use only for a server not a client purpose. Then I would place the save dialog code right after the conversion at the end of the code you provided.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2009 at 09:34 AM

    That makes much more sense than I was originally thinking..

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.