注:本程序只用于UNICODE系统,比如ECC6,或者部分的UNICODE版本的470、ECC5等
REPORT z_barry_test.
DATA: BEGIN OF itab OCCURS 0 ,
f1(8) TYPE c,
f2(6) TYPE c,
f3(12) TYPE c,
END OF itab.
START-OF-SELECTION.
itab-f1 = 'abc '.
itab-f2 = 'def '.
itab-f3 = '啊ANTF'.
APPEND itab.
itab-f1 = '测试'.
itab-f2 = '中文'.
itab-f3 = '四啊啊'.
APPEND itab.
itab-f1 = '测'.
itab-f2 = '中文'.
itab-f3 = '四三三abc'.
APPEND itab.
PERFORM download TABLES itab
USING 'c:\Barrytest.txt'.
*&---------------------------------------------------------------------*
*& Form download
*&---------------------------------------------------------------------*
FORM download TABLES intab
USING filename TYPE c.
DATA: BEGIN OF outtab OCCURS 0,
line TYPE string ,
END OF outtab.
DATA: str TYPE string ,
m TYPE i.
FIELD-SYMBOLS: ,
.
LOOP AT intab ASSIGNING .
DO .
ASSIGN COMPONENT sy-index OF STRUCTURE TO .
IF sy-subrc <> 0 .EXIT. ENDIF.
str = .
DESCRIBE FIELD LENGTH m IN CHARACTER MODE .
m = m - cl_abap_list_utilities=>dynamic_output_length( str ) .
DO m TIMES.
CONCATENATE str '' INTO str SEPARATED BY space.
ENDDO.
CONCATENATE outtab-line str INTO outtab-line.
ENDDO.
APPEND outtab.
CLEAR outtab.
ENDLOOP.
str = filename.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = str
filetype = 'DAT'
codepage = '8400'
trunc_trailing_blanks_eol = ''
CHANGING
data_tab = outtab[].
ENDFORM. "download
阅读(3244) | 评论(0) | 转发(0) |