2021 Feb 12 10:19 AM
Dear SAP Experts,
Do you know whether exist a functionality within SAP to "unzip" a .gz file extension?
In the Server, we have compress files with this extension and we have to develop a new custom program "unzip" the files and read data.

Best Regards and thanks in advance for your ideas.
2021 Feb 12 12:03 PM
2021 Feb 12 12:51 PM
Hi!
Frederic suggested CL_ABAP_UNGZIP_TEXT_STREAM. That should work, but seems a bit tricky.
There is also CL_ABAP_GZIP:
Class CL_ABAP_GZIP Functionality
This class enables you to perform data compression with the DEFLATE algorithm as well as create and decode GZIP files.
The DEFLATE algorithm is used in different file formats, including GZIP and ZIP for data compression.
The following methods enable you to compress or decompress texts (as C strings or C fields) or binary data (as X strings or X fields) using the DEFLATE algorithm.
The following methods create or decode GZIP files in accordance with the format specification in RFC 1952, and allow you to access the relevant fields there.
The class can be used to create and decode ZIP files. One of the main differences between ZIP files and GZIP files is that ZIP files can contain multiple compressed files.
Further information
For further information, refer to the individual methods.
2021 May 20 3:35 AM
Hi, plz let me know if you have implemented the process, I have to do same for my project.
Appreciate your help and suggestion.
2021 May 20 8:45 AM
Hi,
I've solved with the simple code:
OPEN DATASET lv_fname FOR INPUT IN TEXT MODE ENCODING DEFAULT FILTER 'uncompress'.
After this , u can do the READ DATASET:
DO.
READ DATASET lv_fname INTO l_content.
..
ENDDO.
Best Regards.
2021 May 20 4:29 PM
2021 May 20 5:23 PM
I tried using below code but variable V_DATA is showing blank no data.
DATA: rv_file(80) TYPE C,
v_data(150) TYPE c.
rv_file = '/shared/ecd/evnt/processed/old/evntarz20210402031000odr3.dat.gz'.
OPEN DATASET rv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT FILTER 'uncompress'.
IF sy-subrc = 0.
DO.
READ DATASET rv_file INTO v_data.
ENDDO.
write: 'success'.
ENDIF.
Note: if v_data is declared XSTRING the program is going to dump
2021 May 20 5:32 PM
My file is in .DAT.GZ I tried using below syntax using BINARY mode
OPEN DATASET rv_file FOR INPUT IN BINARY MODE FILTER 'uncompress'.
in READ statement V_DATA is showing with '#########' and program is terminating.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |