Esta es una práctica solución para que los usuarios puedan
guardar los formularios directamente en formato PDF.
Su implementación es simple
form genera_salida.
data: r_document_output_info type ssfcrespd,
r_job_output_info type ssfcrescl,
r_job_output_options type ssfcresop,
l_pdf like tline occurs 100 with header line.
data: is_otf type c,
id_spool like tsp01-rqident.
data: pdf_bytecount type i.
data: begin of it_pdf_output occurs 0.
include structure tline.
data: end of it_pdf_output.
data: filename type string.
*
[1]* Identificacion de SmartForm
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'Z_SMF_01'
importing
fm_name = g_fm_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
* creo el Spool para la impresion
g_output_options-tdnewid = 'X'. "pdf (nuevo spool) - Requerido
g_control_parameters-getotf = 'X'. "pdf (Retorno tab.OTF.)
g_control_parameters-preview = 'X'. "No Mostrar V2
g_control_parameters-no_dialog = 'X'. "No Mostrar V2
[2]* Imprimo el Documento
* Ejecucion de Smartform.
g_docu = g_docu + 1.
call function g_fm_name
exporting
control_parameters = g_control_parameters
output_options = g_output_options
user_settings = 'X'
per_ini = p_begda
per_fin = p_endda
importing
document_output_info = r_document_output_info
job_output_info = r_job_output_info
job_output_options = r_job_output_options
tables
p01 = it_p01
t01 = it_t01
total = it_total
exceptions
formacling_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
if sy-subrc eq 0.
* Recupero el OTF del Smartform
y lo muestro como PDF.
call function 'SSFCOMP_PDF_PREVIEW'
exporting
i_otf = r_job_output_info-otfdata
EXCEPTIONS
CONVERT_OTF_TO_PDF_ERROR = 1
CNTL_ERROR = 2
OTHERS = 3 .
endif.
como siempre les digo, si hay una forma mejor o mas simple me avisan.