‎2006 Jun 01 11:00 AM
Hi,
I am working in a banking sector HR implementation, one of their requirement is that, they want to save the smartform output instead of printing ( actually they want both ). Can anybody suggest me how to do that.
Regards,
Baiju
‎2006 Jun 01 11:02 AM
Hi,
YOU can convert it into PDF and can save or print whenever you require.
<u>Convert SmartForm to PDF:</u>
1.Print Smartform to spool .
2.Run RSTXPDFT4 program it will ask the spool number.
3.supply the spool number generated in step 1.
(or)
Use this program .
*&---------------------------------------------------------------------*
*& Report ZSMARTFORM_PDF *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
report zsmartform_pdf .
*SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
*PARAMETER: p_date LIKE sy-datum.
*PARAMETER: p_rea TYPE char255.
*SELECTION-SCREEN: END OF BLOCK b1.
data: p_date like sy-datum value '20060202'.
data: p_rea type char255 value 'Nothing Succeeds Like Success'.
data: ws_ucomm like sy-ucomm.
*
*INITIALIZATION.
* SET PF-STATUS 'STANDARD' OF PROGRAM 'zsmartform_pdf'.
*
*AT SELECTION-SCREEN.
* ws_ucomm = sy-ucomm.
* CASE ws_ucomm.
* WHEN '&PDF'.
* PERFORM f1000_download_form.
* EXIT.
* WHEN '&BACK'.
* SET SCREEN 0.
* EXIT.
* WHEN '&EXIT'.
* SET SCREEN 0.
* EXIT.
* WHEN '&canc'.
* SET SCREEN 0.
* LEAVE TO SCREEN 0.
* ENDCASE.
*&---------------------------------------------------------------------*
*& Form F1000_DOWNLOAD_FORM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
*FORM f1000_download_form.
data: form_name type rs38l_fnam.
data: wa_ctrlop type ssfctrlop,
wa_outopt type ssfcompop.
data: t_otfdata type ssfcrescl,
t_pdf_tab like tline occurs 0 with header line.
data: t_otf type itcoo occurs 0 with header line.
data: w_filesize type i.
data: w_bin_filesize type i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZSMARTFORM_PDF'
* VARIANT = ' '
* DIRECT_CALL = ' '
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
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
control_parameters = wa_ctrlop
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
output_options = wa_outopt
user_settings = 'X'
mydate = p_date
reason = p_rea
importing
* DOCUMENT_OUTPUT_INFO =
job_output_info = t_otfdata
* JOB_OUTPUT_OPTIONS =
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.
t_otf[] = t_otfdata-otfdata[].
call function 'CONVERT_OTF'
exporting
format = 'PDF'
max_linewidth = 132
* ARCHIVE_INDEX = ' '
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 function 'WS_DOWNLOAD'
exporting
bin_filesize = w_bin_filesize
* CODEPAGE = ' '
filename = 'c:test.PDF'
filetype = 'BIN'
* MODE = ' '
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* COL_SELECT = ' '
* COL_SELECTMASK = ' '
* NO_AUTH_CHECK = ' '
importing
filelength = w_filesize
tables
data_tab = t_pdf_tab
* FIELDNAMES =
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.
if sy-subrc <> 0.
message i003(z00) with 'File not downloaded succesfully'.
else.
message i003(z00) with 'File Test.pdf downloaded succesfully '
'under C drive'.
endif.
*ENDFORM. " F1000_DOWNLOAD_FORM<i>Hope This Info Helps YOU.</i>
Regards,
Raghav
‎2006 Jun 01 11:04 AM
‎2006 Jun 01 11:16 AM
Hi,
You can do both print and save the smartforms output.
First prepare your data to print on the smartform layout.
Call the smartform, you will get generated function module.
Assign the correponding parameters to the fucntion module. And here, this function module returns three parameters
DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS
JOB_OUTPUT_INFO is type of structure SSFCRESCL. Look at SSFCRESCL for OTFDATA.
Get OTFDATA into an internal table and call function module CONVERT_OTF_2_PDF.
this function module having table parameter OTF. So assign our internal table to this parameter.
Donot pass any information for the Archieve parameters of this function module.
Let me konw if you have any issues.
Regards,
Rama