ABAP顾问
分类:
2008-12-12 12:52:25
REPORT z_barry_zip_file.
DATA: IZIP TYPE REF TO CL_ABAP_ZIP,
CONT TYPE XSTRING ,
XZIP_FILE TYPE XSTRING,
BINARY_TAB TYPE STANDARD TABLE OF X255 ,
BIN_LEN TYPE I .
DATA: itab TYPE STANDARD TABLE OF sdokcntasc .
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\upload.zip'
filetype = 'BIN'
IMPORTING
filelength = bin_len
TABLES
data_tab = binary_tab.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = bin_len
IMPORTING
buffer = xstr
TABLES
binary_tab = binary_tab
EXCEPTIONS
failed = 1
OTHERS = 2.
CREATE OBJECT cl_zip.
CALL METHOD cl_zip->load
EXPORTING
zip = xstr.
LOOP AT cl_zip->files INTO ls_file .
WRITE: / ls_file-name,
ls_file-date,
ls_file-time,
ls_file-size .
CALL METHOD cl_zip->get
EXPORTING
name = ls_file-name
IMPORTING
content = xstr.
ENDLOOP.
chinaunix网友2010-02-04 21:45:38
REPORT z_barry_test . DATA: izip TYPE REF TO cl_abap_zip, cont TYPE xstring , xzip_file TYPE xstring, binary_tab TYPE STANDARD TABLE OF x255 , bin_len TYPE i . 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