ABAP - Keyword Documentation →  ABAP - Dictionary →  Classic Objects in ABAP Dictionary → 

Replacement Objects

A CDS view can be assigned (using the name of its CDS entity) as a replacement object to a transparent database table and to a classic database view in ABAP Dictionary. The prerequisite here is that the structure type that is defined by the database table or by the classic view is the same as the structure type defined by the CDS view.

In the following cases if a database table or a classic view is accessed and a replacement object is assigned to the table or view, the replacement object is evaluated instead of the database table or classic view:

All other access types are still performed on the database table or classic view such as:

Writes like this produce a syntax check warning and are forbidden in strict mode from Release 7.50.
Here it is not important how the database object was created. This means, in addition to natively created views, the views defined for classic database views in ABAP Dictionary or for CDS views on the database also do not access the replacement object. A similar principle applies to AMDP procedures and AMDP functions. Even if Open SQL is used to access a classic database view of ABAP Dictionary, a CDS view or a CDS table function, which comprises database tables with replacement objects, no redirection occurs. In these cases, the replacement object must be accessed directly. For classic database views, a replacement object can be created that performs this task without the need to modify the programs.

When you define a replacement object for a database table for a classic database view, the system checks whether the specified CDS view fulfills the prerequisites. If a CDS view used as a replacement object is changed later on in such a way that the prerequisites are no longer fulfilled, a runtime error DBSQL_REDIRECT_INCONSISTENCY occurs when an Open SQL read is performed on the database table or on the database view.

No replacement objects can be defined for global temporary tables. In customer systems, replacement objects can only be defined for self-defined database views but not for database tables.

Notes

Example

See Replacement Object for Database Table.



Continue
Replacement Object for Database Table