on 09-10-2007 8:10 AM
Hello Experts,
I have another problem regarding Smartforms. I am downloading my smartform output in pdf format using the following fm's:
CONVERT_OTF_2_PDF
DOWNLOAD
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,
Please let me know whether you are downloading the Smartform output to pdf through the spool id or directly through the OTF file.
We usually get the problem when you download through spool id.
Thanks,
Geeta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Go through this link it may help in solving your problem
http://help.sap.com/saphelp_470/helpdata/EN/a5/de6838abce021ae10000009b38f842/frameset.htm
Regards,
SaiRam
Hi,
Please check this it might be useful.
Data: tab_otf_data type ssfcrescl,
wa_out_opt type ssfcompop,
wa_con_params type ssfctrlop.
wa_rspoid type rspoid,
parameter:p_file like rlgrap-filename no-display.
Follow control parameters
wa_out_opt-tdimmed = 'X'.
wa_out_opt-tdnewid = 'X'
wa_con_params-no_dialog = 'X '.
if you want print direct pass
wa_out_opt-tddest = 'printer' (SAP Printer)
call function fm_name
exporting
control_parameters = wa_con_params
output_options = wa_out_opt
header_header = wa_ven
importing
job_output_info = tab_otf_data
tables
header_details = itab_final
exceptions
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
endloop.
you will get the otf data and spool id from 'tab_otf_data'
read table tab_otf_data-spoolids index 1 into wa_rspoid. " Now you get spool no in wa_rspoid.
" pass spool in to rstxpdft4 it converts to pdf".
submit rstxpdft4
with spoolno = wa_rspoid
with p_file = p_file
and return.
I feel that your problem will solve....
Thanks,
Hari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As you are capturing the OTF data from Smartform itself, try using Convert_otf and then GUI_DOWNLOAD Function Modules to download as pdf.
I am sending you the code. Please check your code against it and still if you have any doubts i ll clarify it. You can just copy paste this code and check it.
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.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.