12-28-2013 7:05 PM
can we do directly coding in smartforms to display its output in pdf format.
12-29-2013 1:23 AM
No you can't, It has to be deal with outside of the SMARTFORMS.
There are several steps.
Before everything, your needs the following variables:
DATA:ls_control_param TYPE ssfctrlop.
DATA:ls_composer_param TYPE ssfcompop.
DATA:ls_job_output_info TYPE ssfcrescl.
DATA:lt_job_output_info TYPE TABLE OF ssfcrescl WITH HEADER LINE.
DATA: lt_pdf TYPE STANDARD TABLE OF tline.
DATA: lt_docs TYPE STANDARD TABLE OF docs.
DATA: l_file_size TYPE i.
1) SSF_FUNCTION_MODULE_NAME
To get the smartforms' function model
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_frm
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
OPTIONAL STEP:
open the connection for pool
control_parameters-no_dialog = 'X'.
control_parameters-preview = 'X'.
control_parameters-getotf = 'X'.
control_parameters-no_open = 'X'.
control_parameters-no_close = 'X'.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
control_parameters = control_parameters
" mail_appl_obj = appl_object_id
" mail_recipient = recipient_id
" mail_sender = sender_id
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
2) call the function model via the first step.
CALL FUNCTION fm_name
EXPORTING
control_parameters = control_parameters
* output_options = ls_composer_param
* user_settings = ''
otry = ''
IMPORTING
* DOCUMENT_OUTPUT_INFO =
job_output_info = ls_job_output_info
TABLES
gt_likp = gt_likp[]
gt_lips = gt_lips[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4.
OPTIONAL STEP:
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
job_output_info = ls_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
3) Get filename
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
default_extension = 'PDF'
default_filename = '*.PDF'
file_filter = 'PDF Files (*.PDF)'
multiselection = ' '
CHANGING
file_table = l_it_filetable
rc = l_result.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
EXPORTING
use_otf_mc_cmd = 'X'
IMPORTING
bin_filesize = l_file_size
TABLES
otf = ls_job_output_info-otfdata[]
doctab_archive = lt_docs[])
lines = lt_pdf[]
EXCEPTIONS
err_conv_not_possible = 1"PDF文件的具体内容(估计是二进制流)
err_otf_mc_noendmarker = 2
OTHERS = 3.
5) save file
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = l_file_size
filename = filename
filetype = c_bin
TABLES
data_tab = lt_pdf.
12-29-2013 5:49 AM
When the function call for a smartform is over the OTF format is retrieved which is converted to PDF.Smartform is either displayed or Display suppressed but the OTF flag is passed so that the data is obtained in parameter job_output_info.
The execution of the smartforms needs to be completed for the OTF,if there is any other way of obtaining the OTF at the end of smartform call ,then it may be possible..
Adobe forms are another way of displaying the output as PDF option.
12-31-2013 1:01 PM
Hi Ranjeet,
Please Refer below screen screen shots it will generate your pdf output.
you can simply download it.
Please enter the below mentioned code ( PDF!) in the command field.
You can download it as a pdf with in few step steps, here no need of doing code for PDF format.
with Regards,
Thangam.P