IF NOT DOWN_F[] IS INITIAL.
CASE DOWN_MODE . "下载模式是放在所选路径下的.TXT文档中
WHEN ‘X‘ .
CALL FUNCTION ‘WS_DOWNLOAD‘
EXPORTING
CODEPAGE = FILE_ENCODING
FILENAME = P_FILE
* filetype = ‘ASC‘
* trunc_trailing_blanks = ‘X‘
TABLES
DATA_TAB = DOWN_F
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11.
WHEN SPACE .
* CALL FUNCTION ‘LIST_TO_ASCI‘
* EXPORTING
* LIST_INDEX = LIST_INDEX
* TABLES
* LISTASCI = DOWN_F
* LISTOBJECT = ABAP_LIST
* EXCEPTIONS
* LIST_INDEX_INVALID = 1
* OTHERS = 2.
* IF SY-SUBRC <> 0.
* Clear MSG_STR . MSG_STR = ‘error in convert ASCII‘ .
* MESSAGE MSG_STR TYPE ‘E‘ .
* ENDIF.
*
CALL FUNCTION ‘GUI_DOWNLOAD‘
EXPORTING
CODEPAGE = FILE_ENCODING
FILENAME = FILENAME
FILETYPE = ‘ASC‘
TRUNC_TRAILING_BLANKS = ‘X‘
TABLES
DATA_TAB = DOWN_F
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
NO_AUTHORITY = 10
OTHERS = 11.
WHEN OTHERS .
ENDCASE.
IF SY-SUBRC = 0 .
MESSAGE TEXT-004 TYPE ‘S‘ .
ENDIF.
ENDIF.
原文:http://www.cnblogs.com/rainysblog/p/6257540.html