Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8712

Re: smartforms output in pdf format

$
0
0

No you can't, It has to be deal with outside of the SMARTFORMS. 

 

There are several steps.

 

Before everything, your needs the following variables:

  DATA:ls_control_param TYPE ssfctrlop.

  DATA:ls_composer_param TYPE ssfcompop.

  DATA:ls_job_output_info TYPE ssfcrescl.

  DATA:lt_job_output_info TYPE TABLE OF ssfcrescl WITH HEADER LINE.

 

  DATA: lt_pdf TYPE STANDARD TABLE OF tline.

  DATA: lt_docs TYPE STANDARD TABLE OF docs.

  DATA: l_file_size TYPE i.

 

1) SSF_FUNCTION_MODULE_NAME

   To get the smartforms' function model

 

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

    EXPORTING

      formname           = p_frm

    IMPORTING

      fm_name            = fm_name

    EXCEPTIONS

      no_form            = 1

      no_function_module = 2

      OTHERS             = 3.

 

OPTIONAL STEP:

   open the connection for pool

  control_parameters-no_dialog = 'X'.

   control_parameters-preview   = 'X'.

  control_parameters-getotf = 'X'.

  control_parameters-no_open   = 'X'.

  control_parameters-no_close  = 'X'.

  CALL FUNCTION 'SSF_OPEN'

EXPORTING

   control_parameters = control_parameters

"  mail_appl_obj      = appl_object_id

  " mail_recipient     = recipient_id

  " mail_sender        = sender_id

 

 

EXCEPTIONS

   formatting_error   = 1

   internal_error     = 2

   send_error         = 3

   user_canceled      = 4

   OTHERS             = 5.

 

 

2) call the function model via the first step.

  CALL FUNCTION fm_name

      EXPORTING

        control_parameters = control_parameters

*        output_options     = ls_composer_param

*        user_settings     = ''

        otry = ''

      IMPORTING

*     DOCUMENT_OUTPUT_INFO       =

        job_output_info    = ls_job_output_info

      TABLES

        gt_likp = gt_likp[]

        gt_lips = gt_lips[]

       EXCEPTIONS

           formatting_error   = 1

           internal_error     = 2

           send_error         = 3

           user_canceled      = 4.

 

OPTIONAL STEP:


      CALL FUNCTION 'SSF_CLOSE'

        IMPORTING

          job_output_info  = ls_job_output_info

        EXCEPTIONS

          formatting_error = 1

          internal_error   = 2

          send_error       = 3

          OTHERS           = 4.

 

3)  Get filename

 

  CALL METHOD cl_gui_frontend_services=>file_open_dialog

    EXPORTING

      default_extension = 'PDF'

      default_filename  = '*.PDF'

      file_filter       = 'PDF Files (*.PDF)'

      multiselection    = ' '

    CHANGING

      file_table        = l_it_filetable

      rc                = l_result.


4) Convert to pdf

      CALL FUNCTION 'CONVERT_OTF_2_PDF'

        EXPORTING

          use_otf_mc_cmd         = 'X'

        IMPORTING

          bin_filesize           = l_file_size

        TABLES

          otf                    = ls_job_output_info-otfdata[]

          doctab_archive         = lt_docs[])

          lines                  = lt_pdf[]

        EXCEPTIONS

          err_conv_not_possible  = 1"PDF文件的具体内容(估计是二进制流)

          err_otf_mc_noendmarker = 2

          OTHERS                 = 3.

 

5) save file

 

      CALL FUNCTION 'GUI_DOWNLOAD'

        EXPORTING

          bin_filesize = l_file_size

          filename     = filename

          filetype     = c_bin

        TABLES

          data_tab     = lt_pdf.

 

 


Viewing all articles
Browse latest Browse all 8712

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>