首先,我的想法是:
1. 把AL11中的文件读到ITAB内表中
2.使用call function 'gui_download' 把ITAB内表的数据下载到本地PC文件上。
现在遇到的问题是,程式能正常运行,但没有数据下载到本地,debug查看call function中ITAB内表的数据,也能找到数据。为何下载到本地文件上没有数据呢????
下面是我的程式代码
Report Z_BDC_DOWNLOAD REPORT z_bdc_download. DATA: BEGIN OF record, data element: MATNR matnr_001(018), data element: XFELD kzsel_02_002(001), data element: MAKTX maktx_003(040), END OF record. DATA itab LIKE record OCCURS 0 WITH HEADER LINE. ----- AL11u4E2Du7684u6587u4EF6 ----- PARAMETERS: p_file(50) DEFAULT 'mm02'. ----- u672Cu5730PCu7684u6587u4EF6u8DEFu5F84 ----- PARAMETERS: d_file(50) DEFAULT 'c:\mm02.txt'. DATA w_file TYPE string. START-OF-SELECTION. u6253u5F00AL11u4E2Du7684u6587u4EF6uFF0Cu5E76u8BFBu53D6u6570u636Eu5230u5185u8868ITABu4E2D OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. READ DATASET p_file INTO itab. CLOSE DATASET p_file. ----- u628AITABu5185u8868u4E2Du7684u6570u636Eu4E0Bu8F7Du5230u672Cu5730PCu4E0A ----- w_file = d_file. CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING BIN_FILESIZE = filename = w_file FILETYPE = 'ASC' APPEND = ' ' WRITE_FIELD_SEPARATOR = ' ' HEADER = '00' TRUNC_TRAILING_BLANKS = ' ' WRITE_LF = 'X' COL_SELECT = ' ' COL_SELECT_MASK = ' ' DAT_MODE = ' ' CONFIRM_OVERWRITE = ' ' NO_AUTH_CHECK = ' ' CODEPAGE = ' ' IGNORE_CERR = ABAP_TRUE REPLACEMENT = '#' WRITE_BOM = ' ' TRUNC_TRAILING_BLANKS_EOL = 'X' WK1_N_FORMAT = ' ' WK1_N_SIZE = ' ' WK1_T_FORMAT = ' ' WK1_T_SIZE = ' ' IMPORTING FILELENGTH = TABLES data_tab = itab FIELDNAMES = EXCEPTIONS file_write_error = 1 no_batch = 2 gui_refuse_filetransfer = 3 invalid_type = 4 no_authority = 5 unknown_error = 6 header_not_allowed = 7 separator_not_allowed = 8 filesize_not_allowed = 9 header_too_long = 10 dp_error_create = 11 dp_error_send = 12 dp_error_write = 13 unknown_dp_error = 14 access_denied = 15 dp_out_of_memory = 16 disk_full = 17 dp_timeout = 18 file_not_found = 19 dataprovider_exception = 20 control_flush_error = 21 OTHERS = 22 . IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
Edited by: Shengtao Tan on Apr 22, 2010 9:57 AM
Edited by: Shengtao Tan on Apr 22, 2010 10:01 AM