cancel
Showing results for 
Search instead for 
Did you mean: 

smartform to pdf

Former Member
0 Kudos

hi guys i have generated a pdf from a smartform but when i try ti open the file it gives me an error, i can see that otf is generated correctly and li_lines also.

Here is my code, any idea?

* Primero recuperamos la función asociada a nuestro formulario
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname = pu_formulario
    IMPORTING
      fm_name  = ld_funcion.
  IF sy-subrc EQ 0.

* obtener parametros impresora
    lt_itcpo-tdcopies   = 1.         " Cantidad de impresiones
    lt_itcpo-tddest     = 'LOCL'.    " Nombre de la impresora
    lt_itcpo-tdimmed    = 'X'.       " Imprime inmediatamente
    lt_itcpo-tdnewid    = 'X'.       " Crear nueva SPOOL
    lt_itcpo-tddelete   = 'X'.       " Borra después de imprimir
    lt_itcpo-tdpageslct = space.     " Todas las páginas
    lt_itcpo-tdpreview  = space.     " Visualización de la impresión
    lt_itcpo-tdcover    = space.     " No portada



    MOVE-CORRESPONDING lt_itcpo TO l_opciones.
    MOVE lt_itcpo-tdpreview TO l_control-preview.

    l_control-getotf = 'X'. "Retorno tab.OTF. Sin imprimir, visualizar
    l_control-preview = ' '.
    l_control-no_dialog = 'X'.
    l_opciones-tdnoprev = 'X'.

  ENDIF.

* Después se ejecuta la función
  CALL FUNCTION ld_funcion
  EXPORTING
    control_parameters         = l_control
    output_options             = l_opciones
    USER_SETTINGS              = ' '
    ekko                       = t_ekko
    lfa1                       = t_lfa1
    d_solicitante              = d_solicitante
    d_firmante                 = p_firma
  IMPORTING
    job_output_info            = l_job_output_info
    job_output_options         = l_output_options
  TABLES
    ekpo                       = i_ekpo
    ekbe                       = i_ekbe
    i_texto_posicion           = li_texto_posicion
  EXCEPTIONS
    formatting_error           = 1
    internal_error             = 2
    send_error                 = 3
    user_canceled              = 4
    OTHERS                     = 5.

  IF pu_modo = c_editar.
    pc_return = sy-subrc.
  ENDIF.



  CALL FUNCTION 'CONVERT_OTF_2_PDF'
    IMPORTING
      bin_filesize           = ld_bin_filesize
    TABLES
      otf                    = l_job_output_info-otfdata
      doctab_archive         = li_docs
      lines                  = li_lines
    EXCEPTIONS
      err_conv_not_possible  = 1
      err_otf_mc_noendmarker = 2
      OTHERS                 = 3.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

aidan_black
Active Contributor
0 Kudos

Hi,

See thread .

there can be problems when you use internal table LINES to return the PDF data in a Unicode system. You should use parameter BIN_FILE when calling CONVERT_OTF so the PDF data is returned as type XSTRING and use the the example BCS_EXAMPLE_8 of SAP note 1324547 to handle the PDF data returned.See also SAP note 1320163.

Regards,

Aidan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

What you have should work. But in my case I'm filling in only the following:

lstr_control_parameters-no_dialog = 'X'.

lstr_control_parameters-getotf = 'X'.

lstr_output_options-tdprinter = lv_e_devtype.

where I get lv_e_devtype from:

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

i_language = 'E'

i_application = 'SAPDEFAULT'

IMPORTING

e_devtype = lv_e_devtype

EXCEPTIONS

no_language = 1

language_not_installed = 2

no_devtype_found = 3

system_error = 4

OTHERS = 5.

Hope this helps.

Thanks,

Arash