on 09-10-2007 1:10 AM
Hello Experts,
I have another problem regarding Smartforms. I am downloading my smartform output in pdf format using the following fm's:
<b>CONVERT_OTF_2_PDF
DOWNLOAD</b>
But when I open the pdf file, there are note-like graphics appearing on the side of the form, something similar to comment notes you place on a word document. I have also tried to substitute CONVERT_OTF_2_PDF with CONVERT_OTF, and DOWNLOAD with GUI_DOWNLOAD. They all produce the same weird error on the form.
When I preview the smartform, the note-like objects are not there, so I'm assuming there is something weird going on during the downloading process.
I have read in a thread somewhere here that they have encountered a similar problem, but no specific solution was proposed.
Can someone please help me?
Thanks in advance.
Hi,
There is something missing in your code itself due to which the file is not opening.
I have worked with the downloading concept for both script and smartform.
I am sending you the code please check it out.
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 if useful.
Thanks,
Geeta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
if u want download the smartform in the form of PDF. there is standard program
RSTXPDFT4 execute this program & pass the spool request number than again execute & specify the path that form converted into PDF format.
Thanks.
Patil
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 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.