How to convert SmartForms into PDF document?

Converting Smart Forms to PDF output

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:

1. First, we define two structures cont_parameters and myoutput based on the
dictionary structures ssfctrlop and ssfcrescl respectively.



2. Then, we assign 'X' to the setotf and no_dialog fields of the control structure.



3. The dynamic call of the Smart Form function module is then carried out.



4. Appropriate variables are then defined. The most important is the internal
table 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.



5. The function module 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.

No comments:

Post a Comment