本地文件上载到SAP 服务器

原文地址: http://hi.baidu.com/mark_ma_lj/blog/item/2e67ebc2964ffd53b319a8bd.html

 

ECC6.0 测试OK.

 

 

DATA: fname TYPE rlgrap-filename,
      ftype TYPE rlgrap-filetype,
      fsize TYPE i.
DATA: fname_p TYPE string,
      fname_n TYPE string.
DATA: sfname_p TYPE string .
DATA: sfname LIKE rcgiedial-iefile.

sfname_p = './'.

 

DATA: r(1) TYPE c.

DATA: data_tab LIKE rcgrepfile OCCURS 10 WITH HEADER LINE.
DATA: lines         TYPE i.

CALL FUNCTION 'UPLOAD'
EXPORTING
    filename            = 'c:/'
    filetype            = 'BIN'
    filetype_no_change = 'X'
IMPORTING
    filesize            = fsize
    act_filename        = fname
    act_filetype        = ftype
TABLES
    data_tab            = data_tab
EXCEPTIONS
    conversion_error    = 1
    invalid_table_width = 2
    invalid_type        = 3.

fname_n = fname.


DO.
 SPLIT fname_n AT '/' INTO fname_p fname_n.
 SEARCH fname_n FOR '/'.
 IF sy-subrc = 4.
    EXIT.
 ENDIF.
ENDDO.
fname_p = fname.


SHIFT fname_p RIGHT DELETING TRAILING fname_n.
SHIFT fname_p LEFT DELETING LEADING space.
CONCATENATE sfname_p fname_n INTO sfname.

DESCRIBE TABLE data_tab LINES lines.

 

CALL FUNCTION 'C13Z_RAWDATA_WRITE'
EXPORTING
    i_file           = sfname
    i_file_size      = fsize
    i_lines          = lines
TABLES
    i_rcgrepfile_tab = data_tab
EXCEPTIONS
    no_permission    = 1
    open_failed      = 2
    OTHERS           = 3.

IF sy-subrc NE 0.
  MESSAGE i000(znyj13) WITH 'UPLOAD SUCC'.
ENDIF.

WRITE: 'SY-SUBRC:', sy-subrc,
     / '
上载的本地文件名:', (60) fname,
     / '
上载的远程文件名:',(60) sfname,
     / '
文件类型:', ftype,
     / '
文件大小:', fsize.
SKIP.

阅读更多
个人分类: SAP ABAP一般
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭