SAP IMPORT DIRECTORY ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for IMPORT_DIRECTORY

IMPORT DIRECTORY

Short Reference
• IMPORT DIRECTORY ABAP Statement
• INTO IMPORT DIRECTORY
• FROM DATABASE IMPORT DIRECTORY
• TO IMPORT DIRECTORY
• CLIENT IMPORT DIRECTORY
• ID IMPORT DIRECTORY


ABAP Syntax IMPORT DIRECTORY INTO itab

FROM DATABASE dbtab(ar) [TO wa] [CLIENT cl] ID id.

What does it do? 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 set up in the same way as described for the EXPORT statement (INDX-like). 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. ComponentTypeMeaning NAMECHAR(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' for flat structures, 'S' for deep structures, 'T' for internal tables with flat row type and 'C' for tables with a deep row type. FTYPECHAR(1)More specific type of the data object saved. For elementary data objects and internal tables with a elementary row type, the data or row type is returned in accordance with the table of return values from DESCRIBE FIELD ... TYPE ('a', 'b', 'C', 'D', 'e', 'F', 'g', 'I', 'N', 'P', 's', 'T', 'X', 'y'). In the case of flat structures and internal tables with flat structured row types, 'C' is returned. In the case of deep structures and internal tables with 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. TFILLINT4Length 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. FLENGINT2Length of saved data object or saved table row in bytes. The value 8 is returned for strings.

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



Example ABAP Coding
Saving three data objects in a data cluster and reading
the directory. The content of the table itab in a Unicode system is as follows: NAMEOTYPE:FTYPE TFILLFLENG 'PAR1''F''a'08 'PAR2''T''I'104 'PAR3''R''C'0168 DATA: f1 TYPE decfloat16,
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 demo_indx_table(hk) ID 'HK'.

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



Runtime Exceptions
Non-catchable Exceptions
Reason for error:
Target table has an invalid structure.
Runtime error:
IMPORT_DIR_WRONG_TABLE_STRUC

Return to menu