首页 > 代码库 > [SAP ABAP开发技术总结]FTP,文件读写

[SAP ABAP开发技术总结]FTP,文件读写

<script type="text/javascript">// </script>
声明:原创作品转载时请注明文章来自SAP师太博客并以超链接形式标明文章原始出处否则将追究法律责任!
原文出自:

20.3.     FTP

FTP_CONNECT

FTP_COMMAND

FTP_DISCONNECT

20.4.     文件读写

DATA: file TYPE string VALUE `jzjflights.dat`,
      wa  
TYPE spfli
.
OPEN DATASET file FOR OUTPUT IN BINARY MODE.
SELECT *
      
FROM
spfli
      
INTO wa.

 
TRANSFER wa TO file. "
ENDSELECT.
CLOSE DATASET file.

 

DATA: file TYPE string VALUE `jzjflights.dat`,
      wa  
TYPE spfli
.
OPEN DATASET file FOR INPUT IN BINARY MODE.
DO.
 
"由于没有使用MAXIMUM LENGTH选项,所以每次读取的最大字节数由wa
所占字节数决定
  READ DATASET file INTO wa. "
 
IF sy-subrc = 0.
   
WRITE: / wa-carrid,
             wa
-connid,
             wa
-countryfr,
             wa
-cityfrom,
             wa
-cityto,
             wa
-fltime,
             wa
-distance.
 
ELSE.
   
EXIT.
 
ENDIF.
ENDDO
.
CLOSE DATASET file.

[SAP ABAP开发技术总结]FTP,文件读写