0% found this document useful (0 votes)
45 views2 pages

Pasar SmartForm A PDF

SAP SmartForm PDF

Uploaded by

ehflores
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views2 pages

Pasar SmartForm A PDF

SAP SmartForm PDF

Uploaded by

ehflores
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Pasar SmartForm a PDF

Es comn que nos pidan hacer un resguardo de un formulario. Y probablemente tengamos que hacer el
backup a PDF.
Con las siguientes pocas lneas vamos a poder hacerlo.

*Declaraciones
DATA: w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
otfdata LIKE itcoo OCCURS 0 WITH HEADER LINE,
lc_name TYPE rs38l_fnam,
intab TYPE soli_tab,
objbin TYPE solix_tab,
wa_intab TYPE LINE OF soli_tab,
wa_objbin TYPE LINE OF solix_tab,
objpack LIKE sopcklsti1 WITH HEADER LINE.

*Funcin que devuelve el modulo de funcin del SmartForm


CALL FUNCTION SSF_FUNCTION_MODULE_NAME
EXPORTING
formname = ZSMARTFORM Nombre del formulario SmartForm
IMPORTING
fm_name = lc_name
EXCEPTIONS
no_form =1
no_function_module = 2
OTHERS = 3.

*Llama al modulo de funcin del SF


w_ctrlop-getotf = X.
w_ctrlop-no_dialog = X.
w_compop-tdnoprev = X.

CALL FUNCTION lc_name


EXPORTING
output_options = w_compop
control_parameters = w_ctrlop
IMPORTING
job_output_info = w_return
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.
ELSE.
otfdata[] = w_return-otfdata[].
ENDIF.

*En la tabla otfdata nos queda guardado el formulario en formtao OTF


*Ahora slo resta convertir el OTF en PDF
LOOP AT otfdata.
wa_intab = otfdata.
APPEND wa_intab TO intab.
CLEAR wa_intab.
ENDLOOP.

*Convertir el OTF en PDF


CALL FUNCTION SX_OBJECT_CONVERT_OTF_PDF
EXPORTING
format_src = OTF
format_dst = PDF
* ADDR_TYPE =
devtype = LP01
* FUNCPARA =
CHANGING
transfer_bin = objpack-transf_bin
content_txt = intab
content_bin = objbin
objhead = intab
len = objpack-doc_size
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.

*LISTO!!! En la tabla objbin nos queda guardado el PDF para salvarlo *en la PC con la funcin
GUI_DOWNLOAD o bien enviarlo por mail con *la funcin
SO_NEW_DOCUMENT_ATT_SEND_API1

You might also like