Skip to Content
avatar image
Former Member

"OTF end command // missing in OTF data" while converting smartform to pdf

Dear ALL,

I'm trying to convert a smartform to pdf format. All programming I've done and there is no activation error.

But In selection screen after putting document number and verndor number when I press F8 (execute), I'm getting print screen and then I put "Output Device" and when I click print preview, firstly it show me an information message "OTF end command // missing in OTF data" and when I click "OK" it shows me "SAVE AS" Dialog Box and after clicking "Save", it saves it but in the task bar it shows me "0 bytes transferred" and also shows print privew of smarform.

So guys, I'm unable to convert a smartform to pdf.

Please Help!

Thanks to all..

Devinder

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Jan 24, 2012 at 10:45 PM

    Please check if the function module belonging to the Smartform processes correctly. It is possible that the FM raises a FORMATTING_ERROR exception, in which case no OTF data is returned. As a consequence, the PDF conversion will fail with the error message you're getting.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 25, 2012 at 07:46 AM

    Hi Devinder,

    I suspect the issue is happening during conversion of smartform to OTF.

    Please go through this link.

    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450

    This will give you some inputs regarding handling OTF data.

    Regards,

    SP.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25, 2012 at 07:17 PM
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
      EXPORTING
        i_language    = v_language
        i_application = 'SAPDEFAULT'
      IMPORTING
        e_devtype     = v_e_devtype.
    
    st_output_options-tdprinter = v_e_devtype.
    st_control_parameters-no_dialog = 'X'.
    st_control_parameters-getotf = 'X'.
    PERFORM process_data.
    
    *&---------------------------------------------------------------------*
    *& Form PROCESS_DATA
    *&---------------------------------------------------------------------*
    * text
    *----------------------------------------------------------------------*
    * --> p1 text
    * <-- p2 text
    *----------------------------------------------------------------------*
    FORM process_data .
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
      formname = 'ZAR_RFQ'
    * variant = ' '
    * direct_call = ' '
    IMPORTING
      fm_name = 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.
    
      wa_ssfctrlop-no_dialog = 'X'.
      wa_ssfctrlop-no_open = 'X'.
    ** wa_ssfctrlop-preview = 'X'.
    ** wa_ssfctrlop-getotf = 'X'.
      wa_ssfctrlop-no_close = 'X'.
    
      CALL FUNCTION 'SSF_OPEN'
    * EXPORTING
    * archive_parameters =
    * user_settings = 'X'
    * mail_sender =
    * mail_recipient =
    * mail_appl_obj =
    * output_options =
    * control_parameters =
    IMPORTING
      job_output_options = wa_sfcresop
    * 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.
    
      wa_ssfcompop-tddest = wa_sfcresop-tddest.
      wa_ssfctrlop-preview = wa_sfcresop-tdpreview.
      MOVE-CORRESPONDING wa_sfcresop TO wa_ssfcompop.
    
      CALL FUNCTION fmname
      EXPORTING
    * archive_index =
    * archive_index_tab =
    * archive_parameters =
        control_parameters = wa_ssfctrlop
    * mail_appl_obj =
    * mail_recipient =
    * mail_sender =
        output_options = wa_ssfcompop
    * user_settings = 'X'
        v_ebeln = v_ebeln
        v_lifnr = v_lifnr
        v_datefrom =
        so_aedat-low
        v_dateto = so_aedat-high
      IMPORTING
        document_output_info = st_document_output_info
        job_output_info = st_job_output_info
        job_output_options = st_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.
    
      CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize           = v_bin_filesize
        TABLES
          otf                    = st_job_output_info-otfdata
          doctab_archive         = it_docs
          lines                  = it_lines
        EXCEPTIONS
          err_conv_not_possible  = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
    
      CONCATENATE 'smrt' '.pdf' INTO v_name.
    
      CREATE OBJECT v_guiobj.
      CALL METHOD v_guiobj->file_save_dialog
        EXPORTING
          default_extension = 'pdf'
          default_file_name = v_name
          file_filter       = v_filter
        CHANGING
          filename          = v_name
          path              = v_path
          fullpath          = v_fullpath
          user_action       = v_uact.
    
      IF v_uact = v_guiobj->action_cancel.
        EXIT.
      ENDIF.
      MOVE v_fullpath TO v_filename.
    
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize            = v_bin_filesize
          filename                = v_filename
          filetype                = 'BIN'
        TABLES
          data_tab                = it_lines
        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.
    
      CALL FUNCTION 'SSF_CLOSE'
    * IMPORTING
    * job_output_info =
    * EXCEPTIONS
    * formatting_error = 1
    * internal_error = 2
    * send_error = 3
    * OTHERS = 4 .
      .
    ENDFORM. " PROCESS_DATA
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 25, 2012 at 06:34 AM

    Hi,

    Are you using FM SSF_GET_DEVICE_TYPE to get the default printer?

    Then pass the device name to job_output_options-tdprinter component and in the control paramenters component, have you checked the getotf field in it.

    If no, please do the above and check.

    Regards,

    Raja.D

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25, 2012 at 06:40 AM

    First of all when you will set GET_OTF parameter you will not be able to see print preview. But if you are using spool to PDF concept then make sure its blank.

    Can you please paste what are the control parameters you are passing.

    Nabheet

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 01, 2012 at 07:08 AM

    == read this code and modify your code according to it.=====

    Edited by: Rob Burbank on Feb 3, 2012 4:52 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Guys,

      Thanks to all for your help..

      I've got the answer from give below code:

      DATA  :  l_spoolno    LIKE tsp01-rqident,         " Spool request number
                 l_time_low   LIKE tsp01-rqcretime,       " Time a spool request was created
                 l_time_high  LIKE tsp01-rqcretime.       " Time a spool request was created
      *           l_file       LIKE rlgrap-filename.       " Path File Name
      *  .
      *  l_file = 'C:\file.pdf'.
        sy-uzeit = sy-uzeit - 20.
        CONCATENATE sy-datum '00000000' INTO l_time_low.
      
        sy-uzeit = sy-uzeit + 20.
        CONCATENATE sy-datum '99999999' INTO l_time_high.
      **********************************************************************************
        SELECT SINGLE MAX( rqident ) FROM tsp01 INTO l_spoolno WHERE
                                     rqclient = sy-mandt AND
                                      rq0name = 'SMART' AND
                                      rqowner = sy-uname AND
                                      rqcretime BETWEEN l_time_low AND
                                      l_time_high.
      
           IF l_spoolno IS NOT INITIAL.
          SUBMIT rstxpdft4 WITH spoolno EQ l_spoolno
                           WITH p_file EQ 'C:\file.pdf'
                           AND RETURN.
         ENDIF.

      Thanks a lot Tamas