将服务器上的文件内容读到内表(read a sequential file)

来源:互联网 发布:最新house5房产网源码 编辑:程序博客网 时间:2024/05/17 02:42

 TYPES: BEGIN OF Z100T_REC,
       cus_num like KNA1-KUNNR,
       name like KNA1-NAME1,
       s_term like KNA1-SORTL,
       city like KNA1-ORT01,
       pos_code like KNA1-PSTLZ,
       country type KNA1-SPRAS,
       Language type Kna1-spras,
end of Z100T_REC.
DATA: STRU TYPE Z100T_REC.
SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE text-t01.
parameters: fname type STRING default 'ZFILE100_SF01.txt'.
selection-screen end of block blk1.

open dataset fname for input in text mode encoding default.
DO.
  read dataset fname into stru.
  IF sy-subrc <> 0.
    exit.
  ENDIF.
write: / stru.
ENDDO.
close dataset fname.