Un viejo algoritmo que tuve que implementar en un servidor 4.6C. Antiguamente, la función que convierte a PDF no tenía la opción de exportar el mismo a XString, por lo que tuve que buscar en internet cómo hacer la transformación.
DATA: cparam TYPE ssfctrlop,
outopt TYPE ssfcompop.
outopt TYPE ssfcompop.
* --suprimir pantalla de dialogo
outopt-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = space.
cparam-getotf = 'X'.
outopt-tddest = 'LP01'.
cparam-no_dialog = 'X'.
cparam-preview = space.
cparam-getotf = 'X'.
CALL FUNCTION fm_name
EXPORTING
control_parameters = cparam
output_options = outopt
user_settings = space
it_datos = it_datos
IMPORTING
job_output_info = it_otf
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
EXPORTING
control_parameters = cparam
output_options = outopt
user_settings = space
it_datos = it_datos
IMPORTING
job_output_info = it_otf
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.
* -- enviar a PFD
ENDIF.
* -- enviar a PFD
DATA: it_otf TYPE ssfcrescl,
pdf_tab TYPE TABLE OF tline WITH HEADER LINE,
pdf_tab TYPE TABLE OF tline WITH HEADER LINE,
filesize TYPE i,
bin_file TYPE xstring.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = filesize
TABLES
otf = it_otf-otfdata
lines = pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
EXIT.
ENDIF.
CHECK NOT pdf_tab[] IS INITIAL.
* ya que no tiene la salida en BIN, la hago yo
CLEAR bin_file.
* convert tline to xstring as needed in
* in web dynpro
FIELD-SYMBOLS <x>.
DATA: st(268) TYPE c.
DATA l1 TYPE i.
DATA len TYPE i.
DATA maxline TYPE i VALUE 134.
l1 = 0.
LOOP AT pdf_tab. " INTO tline.
CLEAR st.
st+l1(maxline) = pdf_tab.
len = maxline + l1.
l1 = maxline - STRLEN( pdf_tab ).
ASSIGN st TO <x> TYPE 'X'.
CONCATENATE bin_file <x>(len) INTO bin_file.
ENDLOOP.
No hay comentarios:
Publicar un comentario