2.选择二进制,包ZDEV01(或$TMP)
3.设置->维护MIME类型: 新建一个MIME类型,
如果要上传EXCEL文档,TYPE:xls/XLS ,EXTENSION: *.XLS,*.xls
4.上述步骤中,如果有excel类型就不用再维护,维护之后,创建新的模板记录:
对象名称:ztest.xls(如果这个名称也加了.xls,那么在程序中也要带上,记住要以Y或Z开头),描述:测试excel模板
点上传按钮
---------------------------------------
下面就是下载这个模板的完整程序代码:
report test_excel_upload.
tables: sscrfields."选择屏幕-下载模板按钮
selection-screen: function key 1. "激活下载模板按钮
selection-screen begin of block b1 with frame title text-b01.
parameters: p_file type rlgrap-filename memory id m01.
parameters: p_mode type ctu_mode default 'N' .
selection-screen end of block b1.
initialization.
sscrfields-functxt_01 = '下载模板'.
at selection-screen.
perform frm_download_template.
*&---------------------------------------------------------------------*
*& Form frm_download_template
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form frm_download_template.
data: lc_file type rlgrap-filename.
data: lc_wwwdatatab type wwwdatatab.
* lc_wwwdatatab-relid = 'MI'.
* lc_wwwdatatab-objid = 'ZTEST.XLS'.或:
lc_wwwdatatab = 'MIZTEST.XLS'.
case sscrfields-ucomm.
when'FC01'."下载模板
"获取要下载的文件路径
call function 'WS_FILENAME_GET'
exporting
def_filename = '计划订单导入模板.xls'
mode = 'S'
importing
filename = lc_file
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
if sy-subrc = 0.
"下载模板到指定路径
call function 'DOWNLOAD_WEB_OBJECT'
exporting
key = lc_wwwdatatab
destination = lc_file.
endif.
endcase.
endform. "frm_download_template
评论