Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  Data Cluster 

EXPORT

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


EXPORT parameter_list TO
medium [COMPRESSION {ON|OFF}]. 

Addition

... COMPRESSION {ON|OFF}

Effect

This statement saves a data cluster defined using parameter_list in a memory medium medium. The addition COMPRESSION can be used to specify whether the data is stored in the cluster in compressed form. A data cluster can be retrieved from the memory medium using the statement IMPORT and deleted using DELETE FROM.

All data objects are archived according to the current byte order (endian) and character-like data objects according to the character format of the current text environment. The ID of the data cluster indicates which byte order and character format have been used during the export. When the data cluster is imported using the IMPORT statement, this ID is evaluated and the data is converted to the current byte order and character format.

A data cluster can have a maximum of 2 GB. Any attempts to export more than 2 GB raise a handleable exception of the class CX_SY_COMPRESSION_ERROR. If a different resource bottleneck occurs earlier, however, its related exception can be raised first.


Note

See also Classes for Data Clusters.


Example

Exports an internal table to a suitable database table DEMO_INDX_BLOB and imports the content from the data cluster to another internal table.

SELECT * 
       FROM scarr 
       INTO TABLE @DATA(itab). 

EXPORT scarr = itab TO DATABASE demo_indx_blob(sc) ID 'DEMO'. 

... 

DATA jtab LIKE itab. 
IMPORT scarr = jtab FROM DATABASE demo_indx_blob(sc) ID 'DEMO'. 

cl_demo_output=>display( jtab ). 

Addition

... COMPRESSION {ON|OFF}

Effect

This addition specifies whether or not the data in the data cluster is compressed. By default, compression is deactivated for all memory media apart from medium database tables. If compression is required, it must be switched on using ON. If stored in a database table, compression is switched on by default and is only switched off if OFF is specified.


Notes

  • When a data cluster is imported using IMPORT, the system automatically recognizes whether or not the data is compressed.
  • Compression saves space, but is more time-consuming.

Example

Exports the compressed result of an XML serialization of an object to the ABAP memory and then imports it.

CLASS cls DEFINITION. 
  PUBLIC SECTION. 
    INTERFACES if_serializable_object. 
    DATA attr TYPE i. 
    METHODS constructor IMPORTING p TYPE i. 
ENDCLASS. 

CLASS cls IMPLEMENTATION. 
  METHOD constructor. 
    attr = p. 
  ENDMETHOD. 
ENDCLASS. 

START-OF-SELECTION. 

  DATA(oref) = NEW cls( 123 ). 

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

  EXPORT xml = xml TO MEMORY ID 'DEMO' COMPRESSION ON. 

  ... 

  CLEAR oref. 
  IMPORT xml = xml FROM MEMORY ID 'DEMO'. 

  CALL TRANSFORMATION id SOURCE XML xml 
                         RESULT oref = oref. 

  cl_demo_output=>display( oref->attr ). 

Continue

EXPORT - parameter_list

EXPORT - medium

Export/Import Tables

EXPORT - Internal Additions

Exceptions in EXPORT