<address id="jv157"></address>
<sub id="jv157"></sub>

      <address id="jv157"></address>

      <thead id="jv157"></thead>

        将本地文件上传到服务器上

        *&---------------------------------------------------------------------*
        *& Report  ZUPLOAD                                                     *
        *&                                                                     *
        *&---------------------------------------------------------------------*
        *&                                                                     *
        *&                                                                     *
        *&---------------------------------------------------------------------*

        REPORT  ZUPLOAD       message-id zmm                          .
        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 = 'c:/'.
        data: r(1) type c.


        DATA: DATA_TAB  LIKE RCGREPFILE OCCURS 10 WITH HEADER LINE.
        DATA: LINES         TYPE I.

        CALL FUNCTION 'UPLOAD'
             EXPORTING
        *          codepage            = 'IBM'
                  filename            = 'c:/'
                  filetype            = 'BIN'
        *          filemask_mask       = '*.XLS'
        *          FILESMASK_TEXT      = 'XLS'
                  FILETYPE_NO_CHANGE  = 'X'
        *          SILENT              = 'X'
        *          item                = ''
             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.
        write:/,'fname_p=',fname_p,'|',
              /,'fname_n=',fname_n,'|'.
        concatenate sfname_p fname_n into sfname.
        write:/,'sfname=',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 s000 WITH 'UPLOAD SUCC'.
        write : 'upload success !'.
        ENDIF.

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

        SKIP. 

        相关文章
        相关标签/搜索
        2020年正版综合资料