Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to read a .ZIP file available in the SAP application server


Hi All,

I went through some of the threads related to reading .zip files at the application server and tried doing the same through ABAP code but it was futile.

I can see the .zip file at the said path in the application server.This .zip file is suppose to contain .txt format files.

Following is my piece of code :

     DATA file_name TYPE string.
     DATA zipped_data TYPE xstring.
     DATA unzipped_data TYPE xstring.
     DATA text_data TYPE string.

     DATA zip TYPE REF TO cl_abap_zip.

   OPEN DATASET file_name  FOR INPUT IN BINARY MODE FILTER 'uncompress'.

   READ DATASET file_name INTO zipped_data.

     CREATE OBJECT zip.
      zip->load( zipped_data ).
      CALL METHOD zip->GET
        EXPORTING
*          NAME                    = zipped_data
          INDEX                   = lv_index
        IMPORTING
          CONTENT                 = unzipped_data
        EXCEPTIONS
          ZIP_INDEX_ERROR         = 1
          ZIP_DECOMPRESSION_ERROR = 2
          others                  = 3.
      IF SY-SUBRC <> 0.
* Implement suitable error handling here
      ENDIF.

While I try to read the file into zipped_data i fetch nothing.

Please throw some light into this .

Quick help will be rewarded.

Regards

Pratibha

Former Member
Not what you were looking for? View more on this topic or Ask a question