Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Transferring zip file

Former Member
0 Likes
1,405

hi,

I am uploading zip file data from client application server, and after recieving the data, again i am downloading the file into Zip format to the sap application server. After downloading is done, recieving message is saying that <b>"n number of bytes has been transferred"</b>. while i am trying to open the file then it is giving the message as follows <b>"Compressed (zipped) folder is invalid or corrupted".</b>

So, do any body have any idea to solve this problem?

-kanthi kiran

hi,

I am uploading zip file data from client application server, and after recieving the data, again i am downloading the file into Zip format to the sap application server. After downloading is done, recieving message is saying that <b>"n number of bytes has been transferred"</b>. while i am trying to open the file then it is giving the message as follows <b>"Compressed (zipped) folder is invalid or corrupted".</b>

So, do any body have any idea to solve this problem?

-kanthi kiran

2 REPLIES 2
Read only

Former Member
0 Likes
788

send me the code when you download the file in zip format .

may be it is not formatted properly.

Also you can following classes.

CL_ABAP_GZIP Class for (De)Compression (GZIP)

CL_ABAP_GZIP_BINARY_STREAM Class for Data Compression (GZIP, Streaming)

CL_ABAP_GZIP_TEXT_STREAM Class for Text Compression (GZIP, Streaming)

CL_ABAP_UNGZIP_BINARY_STREAM Class for Data Decompression (UnGzip, Streaming)

CL_ABAP_UNGZIP_TEXT_STREAM Class for Text Decompression (UnGzip Text Streaming)

CL_ABAP_ZIP Zip Utility

Please reward if useful.

Read only

0 Likes
788

hi,

I have used one of those class to decompress, still it is giving an error and saying that "type-compatible"

<b>

PARAMETERS: PA_FILE LIKE RLGRAP-FILENAME OBLIGATORY.

  • FILE_NEW LIKE RLGRAP-FILENAME OBLIGATORY.

DATA : AUX_FILE TYPE STRING.

DATA : BEGIN OF IT_ITAB OCCURS 0,

TEXT(250) TYPE C,

END OF IT_ITAB.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_FILE.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

PROGRAM_NAME = SYST-REPID

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = PA_FILE

CHANGING

FILE_NAME = PA_FILE.

*AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE_NEW.

*CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

  • EXPORTING

  • PROGRAM_NAME = SYST-REPID

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = FILE_NEW

  • CHANGING

  • FILE_NAME = FILE_NEW.

START-OF-SELECTION.

MOVE : PA_FILE TO AUX_FILE .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = AUX_FILE

HAS_FIELD_SEPARATOR = 'X'

READ_BY_LINE = 'X'

TABLES

DATA_TAB = IT_ITAB.

OPEN DATASET '/usr/sap/tmp/TEST.ZIP' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT IT_ITAB.

TRANSFER IT_ITAB TO '/usr/sap/tmp/TEST.ZIP' .

ENDLOOP.

close dataset '/usr/sap/tmp/TEST.ZIP' .

OPEN DATASET '/usr/sap/tmp/TEST.ZIP' FOR INPUT IN TEXT MODE ENCODING DEFAULT.

Refresh : it_itab .

cLEAR : IT_ITAB .

**LOOP AT IT_ITAB.

Do .

READ DATASET '/usr/sap/tmp/TEST.ZIP' INTO IT_ITAB.

if sy-subrc <> 0 .

Exit .

endif .

APPEND IT_ITAB.

enddo .

close dataset '/usr/sap/tmp/TEST.ZIP' .

*TRY.

CALL METHOD CL_ABAP_GZIP=>DECOMPRESS_BINARY

EXPORTING

GZIP_IN = '/usr/sap/tmp/TEST.ZIP' .

  • GZIP_IN_LEN = -1

  • IMPORTING

  • RAW_OUT =

  • RAW_OUT_LEN =

.

  • CATCH CX_PARAMETER_INVALID_RANGE .

  • CATCH CX_SY_BUFFER_OVERFLOW .

  • CATCH CX_SY_COMPRESSION_ERROR .

*ENDTRY.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = 'TEST.ZIP' "'/usr/sap/tmp/TEST.ZIP'

FILETYPE = 'ASC'

WRITE_LF = 'X'

TABLES

DATA_TAB = IT_ITAB.</b>