on 02-26-2008 2:30 PM
Hi Friends
I have a Smartform : XXXXXx
Driver Program : YYYYYY.
My requirement is : To convert the Smartform output to PDF Form.
I have sample code:
TABLES: tsp01.
*
* TYPES: BEGIN OF t_spool,
* rqident TYPE tsp01-rqident,
* END OF t_spool.
* DATA: i_spool TYPE STANDARD TABLE OF t_spool,
* wa_spool TYPE t_spool.
*
* SELECT rqident FROM tsp01
* INTO TABLE i_spool
* WHERE rqowner = sy-uname.
*
* SORT i_spool DESCENDING BY rqident.
*
* LOOP AT i_spool INTO wa_spool.
* ENDLOOP.
*
* TYPES: l_ty_tab_pdf TYPE tline OCCURS 0.
*
* DATA: l_pdf TYPE l_ty_tab_pdf,
* l_spool TYPE tsp01-rqident.
*
** Type for binary attachment table.
* TYPES: l_ty_tab_objbin TYPE solisti1 OCCURS 0.
*
* DATA: l_objbin TYPE l_ty_tab_objbin.
* l_spool = wa_spool-rqident.
*
* CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
* EXPORTING
* src_spoolid = l_spool
* no_dialog = ' '
* TABLES
* pdf = l_pdf
* EXCEPTIONS
* err_no_abap_spooljob = 1
* err_no_spooljob = 2
* err_no_permission = 3
* err_conv_not_possible = 4
* err_bad_destdevice = 5
* user_cancelled = 6
* err_spoolerror = 7
* err_temseerror = 8
* err_btcjob_open_failed = 9
* err_btcjob_submit_failed = 10
* err_btcjob_close_failed = 11
* OTHERS = 12.
* IF sy-subrc <> 0.
* WRITE: / 'error', sy-subrc.
* ENDIF.
*
***/ Convert the PDF format to the table type required for the attachment.
*
* CALL FUNCTION 'QCE1_CONVERT'
* TABLES
* t_source_tab = l_pdf
* t_target_tab = l_objbin
* EXCEPTIONS
* convert_not_possible = 1
* OTHERS = 2.
* IF sy-subrc <> 0.
* WRITE: / 'error', sy-subrc.
* ENDIF.
My concern is : Where I have to write this code.
Can you please tell me the eact place in the program I have to write this code.
<REMOVED BY MODERATOR>
Regards,
Sree
Edited by: Alvaro Tejada Galindo on Feb 26, 2008 10:56 AM
hi Sree Ram,
Just Replicate this code according to ur Reqmts,
DATA: wa_output_options TYPE ssfcompop,
wa_control_parameters TYPE ssfctrlop,
t_otfdata TYPE ssfcrescl,
t_pdf_tab TYPE TABLE OF tline WITH HEADER LINE.
DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
DATA: w_filesize TYPE i.
DATA: w_bin_filesize TYPE i.
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
w_return TYPE ssfcrescl.
wa_output_options-tdimmed = 'X'.
wa_control_parameters-device = 'PRINTER'.
wa_control_parameters-preview = 'X'.
IF rb3 = 'X'.
wa_control_parameters-getotf = 'X'.
wa_control_parameters-no_dialog = 'X'.
ENDIF.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZHZLPP_CLZSN_DAILY_MIS'
IMPORTING
fm_name = v_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = wa_control_parameters
output_options = wa_output_options
user_settings = 'X'
header = v_header
date = p_repdt
l_bptarget = disp_bptarget
l_act_d = disp_act_d
l_act_c = disp_act_c
disp_d_kwh = disp_d_kwh
disp_c_kwh = disp_c_kwh
disp_d_mw = disp_d_mw
disp_c_mw = disp_c_mw
disp_tot_kah = disp_tot_kah
disp_avg_kah = disp_avg_kah
disp_d_kwh_mt = disp_d_kwh_mt
disp_m_kwh_mt = disp_m_kwh_mt
disp_d_mt_mw = disp_d_mt_mw
disp_m_mt_mw = disp_m_mt_mw
disp_pow_gen = disp_pow_gen
disp_pow_gen_d = disp_pow_gen_d
disp_pow_gen_c = disp_pow_gen_c
disp_ftd_h1 = disp_ftd_h1
disp_ftd_h2 = disp_ftd_h2
disp_ftd_h3 = disp_ftd_h3
disp_ftd_h4 = disp_ftd_h4
disp_ftd_h5 = disp_ftd_h5
disp_ftd_o1 = disp_ftd_o1
disp_ftd_o2 = disp_ftd_o2
disp_ftd_o4 = disp_ftd_o4
disp_ftd_o5 = disp_ftd_o5
disp_cum_o1 = disp_cum_o1
disp_cum_o2 = disp_cum_o2
disp_cum_o4 = disp_cum_o4
disp_cum_o5 = disp_cum_o5
disp_cath_d = disp_cath_d
disp_cath_c = disp_cath_c
disp_anode_d = disp_anode_d
disp_anode_c = disp_anode_c
IMPORTING
job_output_info = w_return " .
TABLES
prod_tab = prod_disp
keyp_tab = keyp_disp
remk_tab = it_remarks
rmat_tab = rmat_disp
rwip_tab = it_disp4
rfng_tab = it_disp_fg
rcur_tab = rcur_disp
rhrs_tab = rhrs_disp
brkd_tab = brkd_disp
keyp_tab1 = keyp_dis1
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE 'Error in printing form' TYPE 'I'.
ENDIF.
********Downloading in pdf format.
IF rb3 = 'X'.
IF l_usract <> 9.
MOVE fullpath TO l_path.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF' "
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
ENDIF.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
bin_filesize = v_len_in
filename = l_path
filetype = 'BIN'
IMPORTING
filelength = w_filesize
TABLES
data_tab = i_tline
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 'File downloaded successfully' TYPE 'S'.
ENDIF.
ENDIF.
ENDIF.
Thanx
bgan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
create executable program in se38
see this
The following code is to convert the smartform into PDF format.
REPORT ZCS_SF61.
DATA: FM_NAME TYPE RS38L_FNAM.
DATA: WA_CTRLOP TYPE SSFCTRLOP, "Smartform control structure
WA_OUTOPT TYPE SSFCOMPOP, "Smart Composer Options
T_OTFDATA TYPE SSFCRESCL, "Return value at end of form printing
T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE. "SAP Scripts: Text lines
DATA: T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE, "OTF Structure
W_FILESIZE TYPE I,
W_BIN_FILESIZE TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZCS_FORM6'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_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'. "Return of OTF Table.No printing,display,or faxing
WA_CTRLOP-NO_DIALOG = 'X'. "SAP Smartform: General indicator
WA_OUTOPT-TDNOPREV = 'X'. "No print preview
CALL FUNCTION FM_NAME " '/1BCDWB/SF00000699'
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'
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 = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_BIN_FILESIZE
BIN_FILE =
TABLES
OTF = T_OTF
LINES = T_PDF_TAB
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 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.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_BIN_FILESIZE
CODEPAGE = ' '
FILENAME = 'D:\TEST11.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
NO_AUTHORITY = 10
OTHERS = 11
.
IF SY-SUBRC = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
WRITE:/ 'THE PDF FILE IS SUCCESSFULLY CONVERTED'.
ENDIF.
Regards
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.
For more information check the following link:
http://www.sap-img.com/smartforms/conversion-of-smartform-output-to-pdf.htm
Regards,
Bhaskar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
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.