zoukankan      html  css  js  c++  java
  • 古老的txt下传和txt上载

    1、下传文件

    TYPES:BEGIN OF TY_DATA,
            A2 TYPE CHAR20,
            B2 TYPE I,
            C2 TYPE CHAR20,
          END OF TY_DATA.
    DATA:IT_DATA TYPE STANDARD TABLE OF TY_DATA WITH HEADER LINE,
         WA_DATA TYPE TY_DATA.
    DATA:IT_DATA1 TYPE STANDARD TABLE OF TY_DATA WITH HEADER LINE,
         WA_DATA1 TYPE TY_DATA.
    DATA:NAME TYPE RLGRAP-FILENAME,TYPA TYPE RLGRAP-FILETYPE.
    WA_DATA-A2 = '我是'.
    WA_DATA-B2 = 1.
    WA_DATA-C2 = '个中国人'.
    APPEND WA_DATA TO IT_DATA.
    CLEAR:WA_DATA.
    WA_DATA-A2 = '你是'.
    WA_DATA-B2 = 10.
    WA_DATA-C2 = '全10美的人'.
    APPEND WA_DATA TO IT_DATA.
    CLEAR:WA_DATA.
    NAME = 'D:TEMPTEXT.txt'.
    TYPA = 'DAT'.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        CODEPAGE                = 'TEXT '
        FILENAME                = NAME
        FILETYPE                = TYPA
        ITEM                    = '文件导出'
      TABLES
        DATA_TAB                = IT_DATA
      EXCEPTIONS
        INVALID_FILESIZE        = 1
        INVALID_TABLE_WIDTH     = 2
        INVALID_TYPE            = 3
        NO_BATCH                = 4
        UNKNOWN_ERROR           = 5
        GUI_REFUSE_FILETRANSFER = 6
        OTHERS                  = 7.
    IF SY-SUBRC <> 0.
    * Implement suitable error handling here
    ENDIF.

    2、上传文件

    CALL FUNCTION 'UPLOAD'
      EXPORTING
        CODEPAGE                = 'TEXT '
        FILENAME                = NAME
        FILETYPE                = TYPA
        ITEM                    = '读入文件 '
      TABLES
        DATA_TAB                = IT_DATA1
      EXCEPTIONS
        CONVERSION_ERROR        = 1
        INVALID_TABLE_WIDTH     = 2
        INVALID_TYPE            = 3
        NO_BATCH                = 4
        UNKNOWN_ERROR           = 5
        GUI_REFUSE_FILETRANSFER = 6
        OTHERS                  = 7.
    IF SY-SUBRC <> 0.
    * Implement suitable error handling here
    ENDIF.
    LOOP AT IT_DATA.
      WRITE:/ IT_DATA-A2,IT_DATA-B2,IT_DATA-C2.
      ENDLOOP.

     

  • 相关阅读:
    Go语言从入门到放弃(三) 布尔/数字/格式化输出
    11. GLOBAL_VARIABLES 与 SESSION_VARIABLES
    10. GLOBAL_STATUS 与 SESSION_STATUS
    9. FILES
    8. EVENTS
    7. ENGINES
    6. COLUMN_PRIVILEGES
    5. COLUMNS
    4. COLLATION_CHARACTER_SET_APPLICABILITY
    3. COLLATIONS
  • 原文地址:https://www.cnblogs.com/BruceKing/p/11346081.html
Copyright © 2011-2022 走看看