ABAP 生成TXT文件

时间:2022-10-29 17:22:22
  *&---------------------------------------------------------------------*
*& Report  ZCREATEFILE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZCREATEFILE.
dataBEGIN OF G_X_MBEW,
        BWKEY(10)  TYPE  C,                
        MATNR      LIKE  MBEW-MATNR,       
        VERPR(15)  TYPE  C,                
      END OF G_X_MBEW.
DATA: G_WA_MBEW like TABLE OF G_X_MBEW.            

CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME         = 'C:\DOWNDIR\file.txt' "file name
    TABLES
      DATA_TAB         = G_WA_MBEW    "inner table
    EXCEPTIONS
      FILE_WRITE_ERROR = 1
      FILE_NOT_FOUND   = 2