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

How to Zip data from Internal table and Write to Application Server ?

pintoo_d
Participant
0 Likes
1,511

Hi Experts,

I have this requirement.

i chkd SDN but didnt find any resolution properly.

I have Tab Delimted data in Single Internal table.

Those Internal Table details, i need to ZIP and then save in Application Server.

I found answers for reading file from AS, then zipping and then writing on it again.

Can anyone help me with this ?

Hi Experts,

I have this requirement.

i chkd SDN but didnt find any resolution properly.

I have Tab Delimted data in Single Internal table.

Those Internal Table details, i need to ZIP and then save in Application Server.

I found answers for reading file from AS, then zipping and then writing on it again.

Can anyone help me with this ?

5 REPLIES 5
Read only

Former Member
0 Likes
1,013

Hi,

Check which zip functionality exist in your system and use it to zip them.

1. You can create unzip file using OPEN DATASET command

2. You can FM SXPG_COMMAND_EXECUTE to call OS command to zip the file

Follow this example on how to use OS zip command [http://lowfatlinux.com/linux-zip-manual.html]

Regards,

Lim...

Read only

amit_khare
Active Contributor
0 Likes
1,013

Use this Class - CL_ABAP_GZIP

Search forum for details on this one.

Read only

0 Likes
1,013

I did

I am writing file to AS using FM C13Z_TEXT_WRITE.

giving Dump.

Read only

0 Likes
1,013

Hi,

I think below link will be a help:

Pooja

Read only

Former Member
0 Likes
1,013
DATA:
  t_spfli TYPE TABLE OF spfli,
  t_out like table of t_spfli,
  lw_xml_in   TYPE string,
  lw_xml_out  TYPE xstring,
 
 
SELECT carrid
       connid
  UP TO 2 ROWS
 FROM spfli INTO TABLE t_spfli.
 
 
  CALL TRANSFORMATION id
       SOURCE output = t_spfli
       RESULT XML lw_xml_in.  " XML Format
 
  IF sy-subrc NE 0.
    RAISE compress_error.
  ENDIF.                               " IF SY-SUBRC NE 0
 
  CALL METHOD cl_abap_gzip=>compress_text
    EXPORTING
      text_in        = lw_xml_in
*    text_in_len    = -1
*    compress_level = 6
*    conversion     = 'DEFAULT'
  IMPORTING
    gzip_out       = lw_xml_out  " Compressed Output
*    gzip_out_len   =
      .
  IF sy-subrc NE 0.
    RAISE compress_error.
  ENDIF.                               " IF SY-SUBRC NE 0
 
use open dataset to store the file on app server.
Read dataset to read from the app server.
******************
*& Decompressing*********
 
      CALL METHOD cl_abap_gzip=>decompress_text
        EXPORTING
          gzip_in      = lw_xml_out
*    gzip_in_len  = -1
*    conversion   = 'DEFAULT'
        IMPORTING
          text_out     = lw_xml_in
*    text_out_len =
 
  CALL TRANSFORMATION id
       SOURCE XML lw_xml_in
       RESULT output = t_out.
 
  IF sy-subrc NE 0.
    RAISE compress_error.
  ENDIF.

Thanks

Sharath