Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  Data cluster →  EXPORT →  EXPORT - Table Structure 

SQL Access to INDX-Like Database Tables

INDX-like database tables are relational databases defined in ABAP Dictionary. This means that, in principle, (Open) SQL statements can also be used to access INDX like database tables.

To use SQL statements on INDX-like database tables effectively, you must respect the special structure of these database tables.

For example, it is not a good idea to access the fields CLUSTR and CLUSTID for read or write operations. These fields contain the data cluster in an internal format and can only be handled correctly using the EXPORT TO DATABASE and IMPORT FROM DATABASE statements.

SQL statements should only be used if the corresponding combination of specific data cluster statements would be too inefficient. The SQL statement INSERT should never be used on an INDX-like database table.

Open SQL statements can, in certain circumstances, be used for administrative operations on INDX-like database tables, for which the data cluster specific statements are not suitable.

Other versions: 7.31 | 7.40 | 7.54

Examples

An INDX-like database can be searched systematically for a particular data cluster using SELECT; at the same time, information in the freely definable columns can be evaluated. The following example deletes all the data clusters from an area of the database table DEMO_INDX_TABLE, that have been created by a specific user. Each time, all rows of the data cluster are to be deleted.

DATA indx_wa TYPE demo_indx_table.

SELECT SINGLE *
       FROM  demo_indx_table
       INTO  indx_wa
       WHERE relid = ... AND
             srtf2 = 0   AND
             userid = sy-uname.

DELETE FROM DATABASE demo_indx_table(...) ID indx_wa-id.

The following example shows, how the identifier and area of a data cluster in the database table DEMO_INDX_TABLE can be altered using UPDATE. Solving this problem using the special cluster statements would be considerably more time-consuming.

UPDATE demo_indx_table
       SET   relid = new_relid
             id    = new_id
       WHERE relid = old_relid AND
             id    = old_id.