Skip to Content
author's profile photo
Former Member

I want to convert smartform html output to pdf output.

I want to convert smartform html output to pdf output.

Is there any function for that or any other option..

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 08:42 AM

    Hi!

    If you are sending the Smartform as an attachment, and then it is in HTML format and this format is what you wanted to convert to PDF, then check out transaction SCOT. There is a switch between the 2 formats.

    Regards

    Tamá

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 08:43 AM

    Hi,

    find the following code for your help.

    
    DATA:       line_cursor TYPE i,        " Position of current character
                  field_start TYPE i,        " Pos. 1st charcter in current field
                  filename TYPE string,
                  filefilter TYPE string,
                  path TYPE string,
                  fullpath TYPE string,
                  user_action TYPE i.
    
      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          file_filter       = filefilter
          default_extension = 'pdf'
        IMPORTING
          filename          = filename
          path              = path
          fullpath          = fullpath
          user_action       = user_action.
    
    
    
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZREQUEST_FORM'
        IMPORTING
          fm_name            = frm
        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 'SSF_GET_DEVICE_TYPE'
        EXPORTING
          i_language    = 'E'
          i_application = 'SAPDEFAULT'
        IMPORTING
          e_devtype     = p_e_devtype.
    
    
      p_output_options-xsfcmode = 'X'.
      p_output_options-xsf = space.
      p_output_options-xdfcmode = 'X'.
      p_output_options-xdf = space.
      p_output_options-tdprinter = p_e_devtype.
    
    *To deactivate the dialogs and to inform SAP Smart Forms that you only
    *want the OTF table to be returned, set the parameters NO_DIALOG and
    *GETOTF of the control structure:
    
      p_control_parameters-no_dialog = 'X'.
      p_control_parameters-getotf = 'X'.
    
      CALL FUNCTION frm            "FNAMEDWB/SF00000304'
       EXPORTING
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
         control_parameters         = p_control_parameters
    
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
         output_options             = p_output_options
    *   USER_SETTINGS              = 'X'
       IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
         job_output_info            =  p_job_output_info
    *   JOB_OUTPUT_OPTIONS         =
        TABLES
          itab                       = itab
          it71                       = it71
    * 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.
    
    
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
    * EXPORTING
    *   USE_OTF_MC_CMD               = 'X'
    *   ARCHIVE_INDEX                =
       IMPORTING
         bin_filesize              = p_bin_filesize
        TABLES
          otf                      = p_job_output_info-otfdata
          doctab_archive           = p_doctab_archive
          lines                    = p_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.
    
    
      IF user_action = 1 OR user_action = 0.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename         = fullpath
            filetype         = 'BIN'
          TABLES
            data_tab         = p_lines
          EXCEPTIONS
            file_write_error = 01
            no_batch         = 04
            unknown_error    = 05
            OTHERS           = 99.
    
      ELSEIF user_action = 2.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            append                = 'X'
            filename              = fullpath
            filetype              = 'BIN'
            trunc_trailing_blanks = 'X'
          TABLES
            data_tab              = p_lines
          EXCEPTIONS
            invalid_type          = 03
            no_batch              = 04
            unknown_error         = 05
            OTHERS                = 99.
      ELSEIF user_action = 9.
        LEAVE TO SCREEN 0.
      ENDIF.
    
      LEAVE TO LIST-PROCESSING.
      WRITE:text-002, fullpath.
    
    
    ENDFORM.                    " EXPORT_FORM
    
    Change the object according to your program.
    
    <i><b>regards
    Debjani
    Rewards point for all helpful answer</b></i>

    Add comment
    10|10000 characters needed characters exceeded