on 10-05-2007 4:47 AM
How can you download into PDF format in SMARTFORMS?
Go through this link it will guide you step wise. Same way as you do for Smartform
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49e15474-0e01-0010-9cba-e62df8244556">Sample</a>
Close the thread once your question is answered.
Regards,
SaiRam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Copy the following the code and check.
&----
*& Report ZPDF_G
*&
&----
REPORT zpdf_g.
DATA: form_name TYPE rs38l_fnam, " Used to get the function module of Smartform
wa_ctrlop TYPE ssfctrlop, " Smart Forms: Control structure
wa_outopt TYPE ssfcompop, " SAP Smart Forms: Smart Composer (transfer) options
t_otfdata TYPE ssfcrescl. " Smart Forms: Return value at end of form printing
Data: t_pdf_tab type table of tline, " SAPscript: Text Lines
t_otf TYPE table of itcoo. " OTF Structure
Variables used to pass to GUI_DOWNLOAD
DATA: w_filesize TYPE i,
w_bin_filesize TYPE i.
Variables used for Save Dialog Box
DATA : file_name TYPE string,
file_path TYPE string,
full_path TYPE string.
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPDF_G' "p_name
IMPORTING
fm_name = form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION form_name
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_outopt
user_settings = 'X'
IMPORTING
job_output_info = t_otfdata
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.
ENDIF.
END-OF-SELECTION.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = w_bin_filesize
TABLES
otf = t_otf
lines = t_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
----
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = file_name
path = file_path
fullpath = full_path
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Download the file to the selected path
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = w_bin_filesize
filename = full_path "fname1
filetype = 'BIN'
IMPORTING
filelength = w_filesize
TABLES
data_tab = t_pdf_tab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE i000(zpdf). "File not downloaded
ELSE.
MESSAGE i001(zpdf). "File downloaded
ENDIF.
Reward points if useful.........
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There is a way to download smartform in PDF format.
Please do the following:
1. Print the smartform to the spool.
2. Note the spool number.
3. Download a PDF file (Acrobat Reader) version of the spool by running Program RSTXPDFT4 and entering the noted spool number.
or.
Migrating a PDF-Based Print Form
1. Go to the Smart Forms initial screen (transaction SMARTFORMS).
2. Choose Utilities> Migration> Interactive Form--> Export.
3. In the dialog box, enter the name of the Smart Form that you want to migrate, the name of the PDF-based target form, and the target interface. The system suggests the name of the Smart Form as the name for the target form and target interface. You can change these names. The target form and the target interface can have different names.
4. Choose Continue.
5. The system displays the Settings dialog box where you can flag various options for migration. To activate the selected options and close the dialog box, choose Continue.
To view additional information about a particular option, select the option, and press F1.
6. In the dialog box Create Object Directory Entry, enter a package for the interface, or save it as a local object.
7. Assign the form to a package, or save the form as a local object.
8. The system migrates the form.
9. If no errors occur during the migration, you can activate the new interface and the PDF-based form. If you see an error message, read Migration with Errors or Warnings below.
Activating an Interface and PDF-Based Print Form
If the form was migrated without errors, the system returns a corresponding message. You now have a PDF-based form (consisting of a form and interface) that you can edit. Initially, migrated forms and interfaces are always inactive and therefore have to be activated before a call can be made from the application.
To activate or edit the form, choose Utilities> Migration>Interactive Form-->Edit.
The system displays the initial screen of the form builder for PDF-based forms. After you have activated the form, you can "switch runtime" as described below.
Switching Runtime
To call the PDF-based form from the application without changes to the ABAP program and formal parameters, proceed as follows:
...
1. Choose Utilities>Migration> Interactive Form-->Switch Runtime.
2. In the dialog box Switch Runtime, enter the name of the Smart Form and the name of the PDF-based form. In the Runtime Type field, select the form that you want to output at runtime.
3. If the PDF form is assigned to a transportable package, you have to assign the runtime switch to a transport request. If this is the case, the system automatically displays a corresponding dialog box.
Migration with Errors or Warnings
If errors or warnings occurred during migration, and the Smart Form was migrated only partially or not at all, a log is displayed. This log is written to the application log and is kept in the system for a week.
To display the log within this time period, choose Utilities>Migration>Interactive Form-->Display Log.
A log is generated for each migration run. If you migrate a Smart Form more than once, you receive multiple logs. Select a log to see the list of the properties that were not or only partially migrated. Each message in the log starts with the node name from the Smart Form, which enables you to identify the source of the error in the form.
Go through this link it may help you solve your problem.
Regards,
Priyanka.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.