上传模板到SAP资源库

 

事物代码:SMW0 -WEB资源库

 

 如果创建后上载本地模板报错,说明没有维护文件类型,需要在导航栏的设置里维护MIME类型添加新的文件后缀名

维护好后再上载模板

ABAP下载模板:以下FORM可以参考

*----------------------------------------------------------------------*
FORM frm_down_template .
  DATA:
         ls_wwwdata_item LIKE wwwdatatab,      "
         lv_file         TYPE rlgrap-filename, "
         lv_objid        TYPE wwwdatatab-objid.
*=======指定本地文件存放路径
  DATA: lv_window_title TYPE string,
        lv_flg_overwrite   LIKE rcgfiletr-iefow,
        lv_ftftype         LIKE rcgfiletr-ftftype,
        lv_flg_stay        TYPE boolean.


*======指定文件存放本地路径
DATA: lv_folder TYPE string.
DATA: lv_title  TYPE string VALUE '指定文件存放本地目录'.
CALL METHOD cl_gui_frontend_services=>directory_browse
  EXPORTING
    window_title         =  lv_title
*    initial_folder       =
  CHANGING
    selected_folder      = lv_folder
  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.

IF p_it = 'X'.
  lv_file = 'IT需求技术文档模板'.
  lv_objid = 'ZABAP001_IT'.
ELSE.
  lv_file = '用户需求技术文档模板'.
ENDIF.

CONCATENATE lv_folder '/' lv_file '.docx' INTO lv_file.
*======下载文档

DATA: ls_wwwdata TYPE wwwdata.

SELECT SINGLE *
INTO  ls_wwwdata
FROM wwwdata
 WHERE objid = lv_objid
  AND srtf2 = ( SELECT MAX( srtf2 ) FROM wwwdata WHERE objid = lv_objid ).


MOVE-CORRESPONDING ls_wwwdata to ls_wwwdata_item.


CALL FUNCTION 'DOWNLOAD_WEB_OBJECT' "
EXPORTING
  key         = ls_wwwdata_item
  destination = lv_file.

ENDFORM.                    " FRM_DOWN_TEMPLATE

 

posted @ 2018-04-12 11:16  学习笔记NO.1  阅读(933)  评论(0编辑  收藏  举报