In this recipe, we will see how the form output may be suppressed and returned as internal table to our calling program and then how a PDF is generated within the program. We will set values to some fields in the control structure of the Smart Form and use it with the CONVERT_OTF_2_PDF
function module.
For generating PDF output without showing the Smart Form on the screen, follow these steps:
cont_parameters
and myoutput
based on the dictionary structures ssfctrlop
and ssfcrescl
respectively.'X'
to the setotf
and no_dialog
fields of the control structure.pdf_content
used for storing the converted PDF output of the form. The filesize
and doc_archive
tables are necessary for calling the function module CONVERT_OTF_2_PDF
.CONVERT_OTF_2_PDF
is then called. The OTF
parameter passes the value of the field otfdata
of the myoutput
structure.The control structure fields no_dialog
and the getotf
are assigned the value 'X'
. This ensures that the form output is suppressed but the form generated is returned to the program in otf
format. The call to the Smart Form
function module (stored in the variable myfunction
) returns to the program the otf
format in the otfdata
field of the myoutput
structure.
We then pass this otfdata
to the function module CONVERT_OTF_2_PDF
. The function module converts the smart form otf
to a PDF and stores it in the internal table pdf_content
passed to the function module for table lines
. The PDF file may then be saved on the desktop using the method CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
, or e-mailed to another user.
18.218.93.169