DATA
: IZIP
TYPE
REF
TO CL_ABAP_ZIP
,
CONT TYPE XSTRING ,
XZIP_FILE TYPE XSTRING ,
BINARY_TAB TYPE STANDARD TABLE OF X255 .
DATA : ITAB TYPE STANDARD TABLE OF SDOKCNTASC .
START-OF-SELECTION .
DO 20 TIMES .
APPEND 'ABAP开发' TO ITAB .
ENDDO .
CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
EXPORTING
MIMETYPE = 'text/html;charset=gb2312'
IMPORTING
BUFFER = CONT
TABLES
TEXT_TAB = ITAB
EXCEPTIONS
FAILED = 1
OTHERS = 2 .
CREATE OBJECT IZIP .
CALL METHOD IZIP -> ADD
EXPORTING
NAME = 'ITAB.TXT'
CONTENT = CONT .
CALL METHOD IZIP ->SAVE
RECEIVING
ZIP = XZIP_FILE .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = XZIP_FILE
TABLES
BINARY_TAB = BINARY_TAB .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\sf.zip'
FILETYPE = 'BIN'
TABLES
CONT TYPE XSTRING ,
XZIP_FILE TYPE XSTRING ,
BINARY_TAB TYPE STANDARD TABLE OF X255 .
DATA : ITAB TYPE STANDARD TABLE OF SDOKCNTASC .
START-OF-SELECTION .
DO 20 TIMES .
APPEND 'ABAP开发' TO ITAB .
ENDDO .
CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
EXPORTING
MIMETYPE = 'text/html;charset=gb2312'
IMPORTING
BUFFER = CONT
TABLES
TEXT_TAB = ITAB
EXCEPTIONS
FAILED = 1
OTHERS = 2 .
CREATE OBJECT IZIP .
CALL METHOD IZIP -> ADD
EXPORTING
NAME = 'ITAB.TXT'
CONTENT = CONT .
CALL METHOD IZIP ->SAVE
RECEIVING
ZIP = XZIP_FILE .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = XZIP_FILE
TABLES
BINARY_TAB = BINARY_TAB .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:\sf.zip'
FILETYPE = 'BIN'
TABLES
DATA_TAB = BINARY_TAB.