cancel
Showing results for 
Search instead for 
Did you mean: 

smartform + pdf

Former Member
0 Kudos

hi friends..

i want to download my smartform in pdf format..

what can i do...

kindly help me

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

All you have to do is call your SF to get OTF and then concert it to PDF. Works like charm:

DATA: p_output_options TYPE ssfcompop,

p_control_parameters TYPE ssfctrlop.

p_control_parameters-no_dialog = 'X'.

p_control_parameters-getotf = 'X'.

CALL FUNCTION v_func_name "call your smartform

EXPORTING

output_options = p_output_options

control_parameters = p_control_parameters

IMPORTING

job_output_info = s_job_output_info.

call function 'CONVERT_OTF_2_PDF'

tables

otf = s_job_output_info-otfdata

lines = t_pdf

and if u need more u can check below links also

Check the below links..

VISIT THIS LINK

Rgds

Reshma

Former Member
0 Kudos

Follow these steps to get the output in PDF

1. Set the GET_OUT parameter in the smart form control parameter (Form Interface - Import - CONTROL_PARAMETERS) to on (X)

2. Transfer the contents of the internal table OTFDATA in the output parameter JOB_OUTPUT_INFO into another internal table and call the function module CONVERT_OTF_2_PDF to convert the OTF data.

3. Call a function module (GUI_DOWNLOAD) with this converted data to download the PDF data to a PDF file on the local system.

Please mark points if the solution was useful.

Regards,

Manoj

Former Member
0 Kudos

HI MANOJ..

can you send me the code please

SuhaSaha
Advisor
Advisor
0 Kudos

Hi Selva,

1. Set the GET_OUT parameter in the smart form control parameter (Form Interface - Import - CONTROL_PARAMETERS) to on (X)

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = fp_c_sfname

IMPORTING

fm_name = fp_v_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION fp_v_fm_name

EXPORTING

control_parameters = wa_control_params

it_inv_data = it_inv_data

st_sf_data = st_sf_data

IMPORTING

job_output_info = wa_otfdata

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5 .

2. Transfer the contents of the internal table <i> wa_otfdata</i> & call the function module CONVERT_OTF_2_PDF to convert the OTF data.

l_it_otf[] = wa_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

TABLES

otf = l_it_otf

lines = it_pdfdata

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

You can also use the function module 'CONVERT_OTF_2_PDF'

3. Call a function module (GUI_DOWNLOAD) with this converted data & pass the internal table <i>fp_it_pdfdata</i> to download the PDF data to a PDF file on the local system.

Former Member
0 Kudos

Use this code. ZSMART is the name of the smart form.

  DATA: ls_control TYPE ssfctrlop,
        ls_output  TYPE ssfcrescl,
        lt_otfout  TYPE tsfotf,
        lv_fmname  TYPE rs38l_fnam.

  DATA: lt_docs  TYPE TABLE OF docs,
        lt_lines TYPE TABLE OF tline.

  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = 'ZSMART'
    IMPORTING
      fm_name            = lv_fmname
    EXCEPTIONS
      no_form            = 1
      no_function_module = 2
      OTHERS             = 3.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  ls_control-getotf = 'X'.
  ls_control-no_dialog = 'X'.

  CALL FUNCTION lv_fmname
   EXPORTING
*     ARCHIVE_INDEX              =
*     ARCHIVE_INDEX_TAB          =
*     ARCHIVE_PARAMETERS         =
     control_parameters         = ls_control
*     MAIL_APPL_OBJ              =
*     MAIL_RECIPIENT             =
*     MAIL_SENDER                =
*     OUTPUT_OPTIONS             =
*     USER_SETTINGS              = 'X'
   IMPORTING
*     DOCUMENT_OUTPUT_INFO       =
     job_output_info            = ls_output
*     JOB_OUTPUT_OPTIONS         =
   EXCEPTIONS
     formatting_error           = 1
     internal_error             = 2
     send_error                 = 3
     user_canceled              = 4
     OTHERS                     = 5
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  lt_otfout[] = ls_output-otfdata[].

  CALL FUNCTION 'CONVERT_OTF_2_PDF'
*   EXPORTING
*     USE_OTF_MC_CMD               = 'X'
*     ARCHIVE_INDEX                =
*   IMPORTING
*     BIN_FILESIZE                 =
    TABLES
      otf                          = lt_otfout
      doctab_archive               = lt_docs
      lines                        = lt_lines
*   EXCEPTIONS
*     ERR_CONV_NOT_POSSIBLE        = 1
*     ERR_OTF_MC_NOENDMARKER       = 2
*     OTHERS                       = 3
            .
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
*     BIN_FILESIZE                    =
      filename                        = 'C:Smart.pdf'
     filetype                        = 'BIN'
*     APPEND                          = ' '
*     WRITE_FIELD_SEPARATOR           = ' '
*     HEADER                          = '00'
*     TRUNC_TRAILING_BLANKS           = ' '
*     WRITE_LF                        = 'X'
*     COL_SELECT                      = ' '
*     COL_SELECT_MASK                 = ' '
*     DAT_MODE                        = ' '
*     CONFIRM_OVERWRITE               = ' '
*     NO_AUTH_CHECK                   = ' '
*     CODEPAGE                        = ' '
*     IGNORE_CERR                     = ABAP_TRUE
*     REPLACEMENT                     = '#'
*     WRITE_BOM                       = ' '
*     TRUNC_TRAILING_BLANKS_EOL       = 'X'
*     WK1_N_FORMAT                    = ' '
*     WK1_N_SIZE                      = ' '
*     WK1_T_FORMAT                    = ' '
*     WK1_T_SIZE                      = ' '
*     WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
*     SHOW_TRANSFER_STATUS            = ABAP_TRUE
*   IMPORTING
*     FILELENGTH                      =
    TABLES
      data_tab                        = lt_lines
*     FIELDNAMES                      =
   EXCEPTIONS
     file_write_error                = 1
     no_batch                        = 2
     gui_refuse_filetransfer         = 3
     invalid_type                    = 4
     no_authority                    = 5
     unknown_error                   = 6
     header_not_allowed              = 7
     separator_not_allowed           = 8
     filesize_not_allowed            = 9
     header_too_long                 = 10
     dp_error_create                 = 11
     dp_error_send                   = 12
     dp_error_write                  = 13
     unknown_dp_error                = 14
     access_denied                   = 15
     dp_out_of_memory                = 16
     disk_full                       = 17
     dp_timeout                      = 18
     file_not_found                  = 19
     dataprovider_exception          = 20
     control_flush_error             = 21
     OTHERS                          = 22
            .
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Please mark points if the solution was useful.

Regards,

Manoj