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

ABAP DECOMPRESS to String/xml

prabhu_s2
Active Contributor
0 Likes
1,925

Hi

I have a requirement to decompress a data which is stored in a table.

The data was compressed by the below code and stored in a table:

EXPORT xtyp = ps_req TO DATA BUFFER ls_pers-input COMPRESSION ON.

I have downloaded the compressed data to a flat file but lost on how to decompress it and view the actual contents.

P.S. I can only download the compressed data to use it in a program for decompressing task. For environmental constraints I will not be able to query the table

Any help on this is highly appreciated.

Thank you

1 ACCEPTED SOLUTION
Read only

raphael_almeida
Active Contributor
1,313

As a sandra.rossi , I don't know what you want to do...

If you do something like I show bellow, you can easily import the data... Also, look in the ABAP documentation for more details of usage of IMPORT/EXPORT statements.

BR,

Pacheco.

REPORT.

DATA: oref  TYPE REF TO data,
      input TYPE xstring.

FIELD-SYMBOLS: <spfli> TYPE STANDARD TABLE.

TRY .
    CREATE DATA oref TYPE STANDARD TABLE OF spfli WITH DEFAULT KEY.

    ASSIGN oref->* TO <spfli>.

    SELECT * FROM spfli INTO TABLE <spfli> UP TO 50 ROWS.

    CALL TRANSFORMATION id SOURCE oref = <spfli> RESULT XML DATA(xml).

    EXPORT xml = xml TO DATA BUFFER input COMPRESSION ON.

    FREE: <spfli>[].
    IMPORT xml = xml FROM DATA BUFFER input.

    CALL TRANSFORMATION id SOURCE XML xml RESULT oref = <spfli>.

    cl_demo_output=>display( <spfli> ).

  CATCH cx_sy_create_data_error
        cx_root
  INTO DATA(err).
    cl_demo_output=>display( err->get_text( ) ).
ENDTRY.
3 REPLIES 3
Read only

Sandra_Rossi
Active Contributor
1,313

What is your question?

Read only

raphael_almeida
Active Contributor
1,314

As a sandra.rossi , I don't know what you want to do...

If you do something like I show bellow, you can easily import the data... Also, look in the ABAP documentation for more details of usage of IMPORT/EXPORT statements.

BR,

Pacheco.

REPORT.

DATA: oref  TYPE REF TO data,
      input TYPE xstring.

FIELD-SYMBOLS: <spfli> TYPE STANDARD TABLE.

TRY .
    CREATE DATA oref TYPE STANDARD TABLE OF spfli WITH DEFAULT KEY.

    ASSIGN oref->* TO <spfli>.

    SELECT * FROM spfli INTO TABLE <spfli> UP TO 50 ROWS.

    CALL TRANSFORMATION id SOURCE oref = <spfli> RESULT XML DATA(xml).

    EXPORT xml = xml TO DATA BUFFER input COMPRESSION ON.

    FREE: <spfli>[].
    IMPORT xml = xml FROM DATA BUFFER input.

    CALL TRANSFORMATION id SOURCE XML xml RESULT oref = <spfli>.

    cl_demo_output=>display( <spfli> ).

  CATCH cx_sy_create_data_error
        cx_root
  INTO DATA(err).
    cl_demo_output=>display( err->get_text( ) ).
ENDTRY.
Read only

prabhu_s2
Active Contributor
0 Likes
1,313

thanks Raphael Pacheco. This was helpful,

sandra.rossi & Raphael Pacheco sorry abt the incomplete questions on the forum