Skip to content

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

IMPORT DIRECTORY

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


IMPORT DIRECTORY INTO itab 
  FROM DATABASE dbtab(ar) [TO wa] [CLIENT cl] ID id.

Effect

This statement passes a table of contents of all data objects of a data cluster that was written to the database table dbtab in the area ar and under the ID specified in id using the statement EXPORT to the internal table itab. The database table dbtab must be structured in the same way as described for the EXPORT statement (as an export/import table). id expects a flat character-like data object that contains the ID of the data cluster and the two-character area ar must be specified directly. The additions TO and CLIENT have the same relevance as described in the statement IMPORT for important data from the data cluster.

For itab, index tables whose row type matches the structure CDIR in ABAP Dictionary are allowed. The following table shows the components of the structure CDIR and their relevance.

Component Type Meaning
NAME CHAR(30) Name of the parameter under which a data object was saved.
OTYPE: CHAR(1) General type of the data object saved. The following values are permitted: "F" for elementary, flat data objects, "G" for strings, "R" forflat structures, "S" fordeep structures, "T" for internal tables with flat row type and "C" for tables with a deep row type.
FTYPE CHAR(1) More specific type of the data object saved. For elementary data objects and internal tables witha elementary row type, the data or row type is returned in accordance with the tables of return valuesfrom DESCRIBE FIELD ... TYPE.In the case of flat structures and internal tables with flat structured row types, "C" is returned. In the case ofdeep structures and internal tableswith deep structured row types, "v" is returned. In the case of a table that has an internal table as a row type, "h" is returned.
TFILL INT4 Length filled of the saved data object. For strings the length of the content in bytes is returned and for internal tables the number of rows is returned. The value 0 is returned for other data objects.
FLENG INT2 Length of saved data object or saved table row in bytes. The value 8 is returned for strings.

System Fields

sy-subrc Meaning
0 The specified data cluster was found and a list of the exported data objects was passed to the internal table itab.
4 The specified data cluster was not found.


Example

Saving three data objects in a data cluster and reading the directory. Afterwards, the content of the table itab is as follows:

NAME OTYPE: FTYPE TFILL FLENG
"PAR1" "F" "a" 0 8
"PAR2" "T" "I" 10 4
"PAR3" "R" "C" 0 168

DATA: f1 TYPE decfloat16, 
      f2 TYPE TABLE OF i, 
      f3 TYPE spfli. 

DATA itab TYPE STANDARD TABLE OF cdir. 

f2 = VALUE #( FOR j = 1 UNTIL j > 10 ( j ) ). 

EXPORT par1 = f1 
       par2 = f2 
       par3 = f3 TO DATABASE demo_indx_blob(hk) ID 'HK'. 

IMPORT DIRECTORY INTO itab FROM DATABASE demo_indx_blob(hk) ID 'HK'. 

cl_demo_output=>display( itab ). 

Exceptions

Non-Handleable Exceptions

  • Cause: Target table has an invalid structure.
    Runtime error: IMPORT_DIR_WRONG_TABLE_STRUC