IMPORT DIRECTORY INTO itab
FROM DATABASE dbtab(ar) [TO wa] [CLIENT cl] ID id.
With this statement, 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 is passed to the internal table itab. The database table dbtab must be set up as described for the statement EXPORT. For id, a flat character-type data object is expected that contains the ID of the data cluster and the two-digit area ar must be specified directly. The additions TO and CLIENT also 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 the ABAP Dictionary are allowed. The following table shows the components of the structure CDIR and their relevance.
Component | Type | Relevance |
NAME | CHAR(30) | Name of the parameter under which a data object was stored. |
OTYPE | CHAR(1) | General type of the stored data object. The following values are possible: "F" for elementary, flat data objects, "G" for strings, "R" for flat structures, "S" for deep structures, "T" for internal tables with flat row type and "C" for tables with a deep row type. |
FTYPE | CHAR(1) | Exact type of the stored data object. For flat, elementary data objects and internal tables with a flat, elementary row type, the data or row type is returend in accordance with the table for allowed ABAP types ("b", "C", "D", "F", "I", "N", "P", "s", "T", "X"). For elementary data objects of the type string or xstring and internal tables that have an elementary row type string or xstring, "g" or "y" is returned. In the case of flat structures and internal tables with flat, structured row type, "C" is returned. In the case of deep structures and internal tables with deep, structured row type, "v" is returned. In the case of a table that has an internal table as a row type, "h" is returned. |
TFILL | INT4 | Filled length of the stored data object. For strings, the length of the content in bytes is returned; for internal tables, the number of rows is returned; for other data objects, the value 0 is returned. |
FLENG | INT2 | Length of the stored data object or the stored table rows in bytes. For strings, the value 8 is returned. |
System fields
sy-subrc | Relevance |
0 | The specified data cluster was found and a list of the imported data objects was passed to the internal table itab. |
4 | The specified data cluster was not found. |
Storing three data objects in a data cluster and reading the directory. The content of the table itab is then as follows:
NAME | OTYPE | FTYPE | TFILL | FLENG |
PAR1 | F | D | 0 | 8 |
PAR2 | T | I | 10 | 4 |
PAR3 | R | C | 0 | 92 |
DATA: f1 TYPE d,
f2 TYPE TABLE OF i,
f3 TYPE spfli.
DATA itab TYPE STANDARD TABLE OF cdir.
DO 10 TIMES.
APPEND sy-index TO f2.
ENDDO.
EXPORT par1 = f1
par2 = f2
par3 = f3 TO DATABASE indx(hk) ID 'HK'.
IMPORT DIRECTORY INTO itab FROM DATABASE indx(hk) ID 'HK'.
Non-Catchable Exceptions