码迷,mamicode.com
首页 > Web开发 > 详细

ABAP文件上传下载 用SMW0

时间:2015-09-23 19:05:32      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:

以excel举例

smw0事物代码进入传输模板到服务器上:

 

下载模板的用到的from代码如下:

FORM sub_chek_directory .
  DATA: l_formkey1 LIKE wwwdatatab.
  DATA: l_filename1 LIKE rlgrap-filename.
  DATA: l_file TYPE string.
  DATA: l_rc LIKE sy-subrc.

  DATA: l_temp(70).
  DATA:l_result TYPE c.
  l_filename1 = C:\Users\00186159\Desktop\333.XLS . "此路径为模版下载到本地的地址,可 自己改

  SELECT SINGLE * INTO CORRESPONDING FIELDS OF l_formkey1 FROM wwwdata WHERE objid = ZEXCEL .

  CLEAR l_file.   CLEAR l_result.    l_file = l_filename1.

  CALL METHOD cl_gui_frontend_services=>file_exist
    EXPORTING
      file            = l_file
    RECEIVING
      result          = l_result
    EXCEPTIONS
      cntl_error      = 1
      error_no_gui    = 2
      wrong_parameter = 3
      OTHERS          = 5.
  IF l_result = space.
    CALL FUNCTION DOWNLOAD_WEB_OBJECT
      EXPORTING
        key         = l_formkey1
        destination = l_filename1
      IMPORTING
        rc          = l_rc
      CHANGING
        temp        = l_temp.
    IF l_temp NE l_filename1.
      MESSAGE e398(00) WITH text-001.
    ENDIF.
  ENDIF.
ENDFORM.  

注意一点: HTML模板和二进制的对象名称可以使用同名,在WWWDATA表里面以RELID 区分。

ABAP文件上传下载 用SMW0

标签:

原文地址:http://www.cnblogs.com/caizjian/p/4832733.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!