Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

when pdf conversion OTF End command // missing in OTF data

Former Member
0 Likes
2,878

Dear experts,

i am unable to the output in pdf..my requirement is when i am executing the report it is showing in pdf..

now smartform is showing properly but when i am converting to pdf it showing the error

OTF End command // missing in OTF data 

how to resolve that issue

8 REPLIES 8
Read only

rajeshkothamasu
Active Participant
0 Likes
1,787

Hi,

Check once the control parameters are maintainer or not. Pass GETOTF control parameter as 'X'

LV_CONTROL_PARAMETERS-GETOTF = 'X'.

CALL FUNCTION FM_NAME
        EXPORTING
          CONTROL_PARAMETERS = LV_CONTROL_PARAMETERS
        IMPORTING
          JOB_OUTPUT_INFO = JOB_OUTPUT
        TABLES
        EXCEPTIONS
          FORMATTING_ERROR = 1
          INTERNAL_ERROR = 2
          SEND_ERROR = 3
          USE

Read only

0 Likes
1,787

yes i already done that but still i am getting error

Read only

0 Likes
1,787

Hi,

can you paste your code.

Read only

0 Likes
1,787

Dear sir,


when i am debugging the otf structure is showing empty..



* Internal table declaration

DATA: it_otf      TYPE STANDARD TABLE OF itcoo,

       it_docs     TYPE STANDARD TABLE OF docs,

       it_lines    TYPE STANDARD TABLE OF tline.

* Declaration of local variables.

DATA:

       st_job_output_info       TYPE ssfcrescl,

       st_document_output_info  TYPE ssfcrespd,

       st_job_output_options    TYPE ssfcresop,

       st_output_options        TYPE ssfcompop,

       v_len_in                 TYPE so_obj_len,

       v_language               TYPE sflangu VALUE 'E',

       v_e_devtype              TYPE rspoptype,

       v_bin_filesize           TYPE i,

       v_name                   TYPE string,

       v_path                   TYPE string,

       v_fullpath               TYPE string,

       v_filter                 TYPE string,

       v_uact                   TYPE i,

       v_guiobj                 TYPE REF TO cl_gui_frontend_services,

       v_filename               TYPE string,

       w_control TYPE ssfctrlop.

CONSTANTS c_formname           TYPE tdsfname VALUE 'ZPAYADV_FORM_NEW_LAN_RTGS'.




w_input-dialog = 'X'.

   w_input-tdnoprev = ' '.

   w_input-tdnoarch = 'X'.

   w_input-tdimmed = 'X'.

   w_input-tddelete = 'X'.

   CALL FUNCTION 'SSFCOMP_OPEN'

     EXPORTING

       input = w_input

     EXCEPTIONS

       error = 1.

   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.

**W_control-no_dialog = 'X'.

**W_control-getotf = 'X'.

   CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

     EXPORTING

       formname           = c_formname

     IMPORTING

       fm_name            = fm_name

     EXCEPTIONS

       no_form            = 1

       no_function_module = 2

       OTHERS             = 3.

   W_control-no_dialog = 'X'.

   w_control-no_open   = 'X'.

   w_control-no_close  = 'X'.

   w_control-getotf = 'x'.




CALL FUNCTION  fm_name "'/1BCDWB/SF00000088'

       EXPORTING

        control_parameters           = w_control

          s_zbukr                    = s_zbukr

          s_vblnr                    = wa_itab-belnr

          s_gjahr                    = s_gjahr

          v_zbukr                    = v_zbukr

          v_chect                    = v_chect

          v_vblnr                    = v_vblnr

          v_zaldt                    = v_zaldt

          v_rwbtr                    = v_rwbtr

          v_banka                    = v_banka

          v_ort01                    = v_ort01

          v_words                    = v_words

          v_amount                   = v_amount

          v_anred                    = v_anred

          v_name1                    = v_name1

          v_name2                    = v_name2

          v_stras                    = v_stras

          v_ort02                    = v_ort02

          v_bezei                    = v_bezei

          v_pstlz                    = v_pstlz

          v_landx                    = v_landx

          s_strgb                    = s_strgb

          v_verkf                    = v_verkf  """"""""""""""Added by SHARDA

          v_telf1                    = v_telf1  """"""""""""

          output_options             = st_output_options

       IMPORTING

     document_output_info  = st_document_output_info

     job_output_info       = st_job_output_info

     job_output_options    = st_job_output_options

       TABLES

         i_final                    = it_final

       EXCEPTIONS

     formatting_error = 1

     internal_error   = 2

     send_error       = 3

     user_canceled    = 4

     OTHERS           = 5.

**      IF SY-SUBRC <> 0.

***--- On Failure display standard Message

**MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

**WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

**else.

*.........................CONVERT TO OTF TO PDF.......................*

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.

IF sy-subrc <> 0.

* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.



REFRESH: it_final, it_bsak ,it_bsak1 ,it_bsak2 ,it_bsak3, it_bsik , it_bsik1,it_bsik2,it_bsik3.

     CLEAR: wa_itab,wa_bsak,wa_bsak1,wa_bsak2,wa_bsik,wa_bsik1,wa_bsik2.

   ENDLOOP.

   CALL FUNCTION 'SSFCOMP_CLOSE'

     EXCEPTIONS

       error = 1.

Read only

0 Likes
1,787

Hi,

As per observation we find that OTF paramater as Lower case

w_control-getotf = 'x'.

Maintain OTF paramater as 'X' not 'x'.

w_control-getotf = 'X'.


Read only

0 Likes
1,787

Compare your code with Convert Smartform to PDF format - Code Gallery - SCN Wiki

You will notice that SSFCOMP_OPEN and SSFCOMP_CLOSE are not used to get otf.

Also, getotf and no_dialog are set in control parameters.

Read only

0 Likes
1,787

Dear experts,

i removed SSFCOMP_OPEN and SSFCOMP_CLOSE and w_control-getotf = 'X'. ..but now the smartform is not generated and also the same error OTF End command // missing in OTF data

Read only

0 Likes
1,787

Hi,

Try with below coding it is working for me.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
         EXPORTING
           formname    = 'ZXXXXXXXXXX_CERT'
*         VARIANT     = ' '
*         DIRECT_CALL = ' '
         IMPORTING
           fm_name     = gv_fmname.
*


       LOOP AT  gt_final INTO gs_final.
*         WHERE FLAG = 'X'.


         REFRESH gt_final1.
         DESCRIBE TABLE gt_final LINES gv_lines.
         APPEND gs_final TO gt_final1.
         CLEAR gs_final .

*
         IF gv_lines <> 1.
           gs_control_parameters-no_open = 'X' .
           gs_control_parameters-no_close = 'X'.
           AT FIRST.
             gs_control_parameters-no_open = '' .
             gs_control_parameters-no_close = 'X'.
           ENDAT.
           AT LAST.
             gs_control_parameters-no_open = 'X' .
             gs_control_parameters-no_close = ''.
           ENDAT.
         ENDIF.
         CLEAR :gs_final.

         gs_control_parameters-GETOTF = 'X'.
         gs_control_parameters-NO_DIALOG = 'X'.


       CALL FUNCTION gv_fmname
        EXPORTING
*         ARCHIVE_INDEX              =
*         ARCHIVE_INDEX_TAB          =
*         ARCHIVE_PARAMETERS         =
          CONTROL_PARAMETERS         = gs_control_parameters
*         MAIL_APPL_OBJ              =
*         MAIL_RECIPIENT             =
*         MAIL_SENDER                =
*         OUTPUT_OPTIONS             =
*         USER_SETTINGS              = 'X'
        IMPORTING
          DOCUMENT_OUTPUT_INFO       = st_document_output_info
          JOB_OUTPUT_INFO            = st_job_output_info
          JOB_OUTPUT_OPTIONS         = st_job_output_options
         TABLES
           GT_FINAL                   = gt_final1
*       EXCEPTIONS
*         FORMATTING_ERROR           = 1
*         INTERNAL_ERROR             = 2
*         SEND_ERROR                 = 3
*         USER_CANCELED              = 4
*         OTHERS                     = 5
                 .
       IF SY-SUBRC <> 0.
* Implement suitable error handling here
       ENDIF.

*.........................CONVERT TO OTF TO PDF.......................*
   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.

*........................GET THE FILE NAME TO STORE....................*
   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.
*..................................DOWNLOAD AS FILE....................*

   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.

       ENDLOOP.