Hola,
para que genere un PDF a partir de un SForm debes hacer lo siguiente:
1) Setear las variables de impresión del formulario, yo lo hice de la siguiente manera:
data: c_p type SSFCTRLOP.
data: o_p type SSFCOMPOP.
c_p-langu = sy-langu.
c_p-no_dialog = 'X'.
c_p-getotf = 'X'.
call function 'SSF_GET_DEVICE_TYPE'
EXPORTING
i_language = sy-langu
IMPORTING
e_devtype = devtype
EXCEPTIONS
no_language = 1
language_not_installed = 2
no_devtype_found = 3
system_error = 4
others = 5.
o_p-tdprinter = devtype.
2) Invocar el formulario ssform:
CALL FUNCTION nombre_modulo_funcion
EXPORTING
CONTROL_PARAMETERS = c_p
OUTPUT_OPTIONS = o_p
USER_SETTINGS = space
IMPORTING
JOB_OUTPUT_INFO = E_ssfcrescl
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
3) Convertir la salida del formulario a PDF:
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
bin_filesize = l_pdf_len
* bin_file = l_pdf_xstring
TABLES
OTF = E_ssfcrescl-OTFDATA
LINES = LT_LINES
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5.
4) Hacer el download del archivo:
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = l_pdf_len
FILENAME = destino
FILETYPE = 'BIN'
TABLES
DATA_TAB = lt_lines
EXCEPTIONS
OTHERS = 9.
clear tt_cli.
refresh tt_cli.
clear tt_doc.
refresh tt_doc.
suerte.-
|