Application Development 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: 

cl_abap_gzip

Former Member
0 Kudos

Hi,

I have used CL_ABAP_GZIP to compress a file and I get the xstring as output and its length.


  TRY.
      CALL METHOD cl_abap_gzip=>compress_binary
        EXPORTING
          raw_in         = raw_in
          raw_in_len     = raw_in_len
          compress_level = 6
        IMPORTING
          gzip_out       = gzip_out
          gzip_out_len   = gzip_out_len.
    CATCH cx_parameter_invalid_range .
    CATCH cx_sy_buffer_overflow .
  ENDTRY.

Now, I would like to download it, and I use gui_download. But gui_download accepts parameters in table:


    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        bin_filesize            = gzip_out_len
        filename                = lv_filename
        filetype                = 'BIN'
      CHANGING
        data_tab                = data_tab.

Do you know how can I get my compressed xstring data (gzip_out) and load into table form (data_tab)? And which file extension should my lv_filename be? (ex: compressed.gzip)??

kindly advise.

thanks & regards,

ginnie

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please have a look at function module SCMS_XSTRING_TO_BINARY

Regards,

Rich Heilman

5 REPLIES 5

naimesh_patel
Active Contributor
0 Kudos

Have to tried to use the gzip_out table in GUI_DOWNLOAD?

Please try like this:

   CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        bin_filesize            = gzip_out_len
        filename                = lv_filename   " << "C:tempcomp.zip"
        filetype                = 'BIN'
      CHANGING
        data_tab                = gzip_out.

Regards,

Naimesh Patel

0 Kudos

Hi Naimesh,

gzip_out from cl_abap_gzip is type xstring. It is not compatible with the type of data_tab. How can i convert this xstring to the data_tab? Is there any FM to convert it?

Kindly advice.

regards,

ginnie

0 Kudos

Try with this FM : SCP_TRANSLATE_CHARS.

Pass INBUFF as your xstring data, recieve in OUTBUFF data.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi,

Better to use that SXPG...etc commands to compress the files rather then using CL_ABAP_GZIP. This class does nto wirk properly.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Please have a look at function module SCMS_XSTRING_TO_BINARY

Regards,

Rich Heilman