10-07-2009 3:12 AM
Hi,
i am using cl_abap_zip get method
lo_zip->get( EXPORTING name = ls_splice-name
IMPORTING content = lv_spliced_content
EXCEPTIONS zip_index_error = 1
zip_decompression_error = 2 ).
i am getting dump when i use this method.Some zip files are working great but some of not decompressed and get dump.
I could not find any OSS note about this issue.DECOMPRESS_BINARY is a kernel function.
error message is :
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_COMPRESSION_ERROR', was not
caught in
procedure "DECOMPRESS_BINARY" "(METHOD)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
The function IctDecompressStream returns the return code 30
Do u have any solution to this?
Thanks
10-07-2009 3:52 AM
10-07-2009 8:27 AM
Hi,
IF SAP does not support winzip files , what should we use then?
Thx
09-16-2010 7:19 PM
Hi,
Here's a program to decrompress a zip file:
REPORT YFPZ0008.
TYPES:
t_xline(2048) TYPE x, "BINARY FILES
BEGIN OF t_line,
line(1024) TYPE c,
END OF t_line. "CONTENT
DATA:
size type i.
DATA:
data_tab TYPE STANDARD TABLE OF t_xline,
text_tab TYPE STANDARD TABLE OF t_line.
DATA:
input_x type xstring, "BINARY CONTENT INPUT
output_x type xstring. "BINARY OUTPUT OUTPUT
data : CL_ZIP type ref to CL_ABAP_ZIP .
DATA files LIKE LINE OF cl_abap_zip=>files.
DATA:
name type string.
PARAMETER:
p_file TYPE string.
PARAMETER:
p_output TYPE string.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
EXPORTING
FILENAME = p_file
FILETYPE = 'BIN'
IMPORTING
FILELENGTH = size
CHANGING
DATA_TAB = data_tab.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
INPUT_LENGTH = size
IMPORTING
BUFFER = input_x
TABLES
BINARY_TAB = data_tab.
CREATE OBJECT cl_zip.
CALL METHOD cl_zip->load(
EXPORTING
zip = input_x
).
LOOP AT cl_zip->files INTO files.
CLEAR output_x.
MOVE files-name TO name.
cl_zip->GET(
EXPORTING
NAME = name " Example.txt (file in the zip file)
IMPORTING
CONTENT = output_x
)
.
REFRESH data_tab.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = output_x
IMPORTING
OUTPUT_LENGTH = size
TABLES
BINARY_TAB = data_tab
.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
INPUT_LENGTH = size
TABLES
BINARY_TAB = data_tab
TEXT_TAB = text_tab
.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = size
FILENAME = p_output
FILETYPE = 'BIN'
CHANGING
DATA_TAB = data_tab
.