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.