zoukankan      html  css  js  c++  java
  • 如何编写上传(PC>AS)和下载(AS->PC)程序示例

    REPORT Z_HO_TTT .

    parameters: pm_cr type TRKORR obligatory.

    data: c_file(80), d_file(80).

    DATA: C_L TYPE STRING, D_L TYPE STRING.

    data: str(12).

    str = pm_cr.

    *shift str left by 3 places.
    *str+7(1) = '.'.
    *str+8(3) = pm_cr(3).

    concatenate '/usr/sap/trans/cofiles/' pm_cr into c_file.
    CONCATENATE 'C:/' pm_cr INTO C_L.
    str(1) = 'R'.
    concatenate '/usr/sap/trans/data/' pm_cr INTO D_FILE.
    CONCATENATE 'C:/' pm_cr INTO D_L.

    DATA: BEGIN OF I_LIST OCCURS 0,
        STR(500),
        END OF I_LIST.

    DATA: I TYPE I, J TYPE I.
    *文本文件下载
    OPEN DATASET C_FILE FOR INPUT IN TEXT MODE.
    DO.
      READ DATASET C_FILE INTO I_LIST.
      IF SY-SUBRC NE 0.
        EXIT.
      ENDIF.
      APPEND I_LIST.
    ENDDO.
    close dataset c_file.

    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *   BIN_FILESIZE                  =
        filename                      = C_L
    *   FILETYPE                      = 'ASC'
      tables
        data_tab                      = I_LIST
              .

    REFRESH I_LIST.
    CLEAR: I_LIST.
    CLEAR: I.
    *二进值文件下载
    OPEN DATASET D_FILE FOR INPUT IN BINARY MODE.
    DO.
      READ DATASET D_FILE INTO I_LIST LENGTH J.
      IF SY-SUBRC NE 0 AND J = 0.
        EXIT.
      ENDIF.
      I = I + J.
      APPEND I_LIST.
    ENDDO.
    close dataset D_file.

    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        BIN_FILESIZE                  = I
        filename                      = D_L
        FILETYPE                      = 'BIN'
      tables
        data_tab                      = I_LIST. 

  • 相关阅读:
    ZOJ
    ZOJ
    ZOJ
    ZOJ
    HDU
    HDU
    CF 429B B.Working out (四角dp)
    HDU
    ScrollView 里的 EditText 与输入法的用例
    Windows hosts (使用方法 && 不定期更新)
  • 原文地址:https://www.cnblogs.com/xiaomaohai/p/6157532.html
Copyright © 2011-2022 走看看