Skip to content

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

Replacement Objects

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

  • The number of components must match.
  • It must be possible to assign a component of the CDS view to each component of the database table or classic view:
  • For all other components of the database table, an identically named element of the CDS view must exist.
The order of the components in the database table and the CDS view does not need to match.
  • The technical type properties built-in data type, length, and number of decimal places must match for all assigned components.
  • The CDS view cannot have any input parameters.
  • It is not possible to have both a replacement object defined and table buffering switched on for a database view whose maintenance status is modifiable.

If a database table or a classic view is accessed and a replacement object is assigned to the table or view in the following cases, 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 in ABAP SQL
Writes of this type produce a syntax check warning.
  • Use in other database objects, such as:
  • Use as a data source of a view defined on the database
  • Access from database procedures or database functions
Here it is not important how the database object was created, which means that, in addition to native 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 ABAP SQL is used to access a classic database view in ABAP Dictionary, a CDS view, or a CDS table function comprising database tables with replacement objects, no redirection is performed. 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.
  • Access types other than with ABAP SQL, for example:

When a replacement object is defined for a database table for a classic database view, the system checks whether the specified CDS view meets the prerequisites. If a CDS view used as a replacement object is changed later and the prerequisites are no longer met, a runtime error DBSQL_REDIRECT_INCONSISTENCY occurs when an ABAP 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 and not for database tables.

If there is a diversion to a CDS view for which one or more CDS roles are defined as part of the CDS access control, the associated access conditions are not evaluated when the replacement object is accessed.

Other versions: 7.31 | 7.40 | 7.54


  • Extreme care should be taken when specifying a replacement object for a database table or a database view. Incorrect usage can cause inconsistencies.

  • Replacement objects are mainly intended for existing aggregate tables. These are database tables, which contain aggregated data from other tables. Instead of aggregating data in an ABAP program and writing data to an aggregate table, which can be exclusively accessed by reads in programs, the aggregation can be performed for every read using the CDS view. This prevents redundant data from being stored. In addition, aggregation on the database can improve performance if it is necessary to read large volumes of data for aggregation in ABAP. Replacement objects can make this possible without invalidating the programs.

  • A prerequisite for assigning a replacement object to an existing database table or database view is that the CDS view returns the expected data and that, apart from aggregation, only ABAP SQL reads are performed on the aggregate table.

  • Once a replacement object is defined, no further writes should be performed on an aggregate table. These writes produce a syntax check warning and are scheduled to be disallowed in an upcoming release.

  • Make sure that, apart from the use of ABAP SQL, no other type of access is performed on an aggregate table with a replacement object. More specifically, CDS views used as a replacement object are not allowed to access the replaced object, because the content is usually no longer updated.

  • It is not advisable to transport table content for which a replacement object is defined. This content is scheduled to no longer be transported in an upcoming release.

  • Table buffering should be deactivated for an aggregate table for which a replacement object is defined to prevent buffer invalidations.

  • In customer systems, it may be useful to define a replacement object for a self-defined classic database view, if a replacement object was defined for one of their basis tables at SAP. In this case, the replacement object of the view must access the replacement object of the basis table.

  • If a database table or a classical view , which a replacement object is defined for, is extended in a follow-on system, the assigned CDS view must also be extended accordingly with EXTEND VIEW.

  • The classic projection view, maintenance views, and help views are not defined on the database. Access to their basis tables is carried out on AS ABAP by using ABAP SQL. If a basis table has a replacement object, its reads are redirected as required.

  • Frameworks that use ABAP SQL, such as Data Browser, automatically access replacement objects if these objects are defined for a database table or a database view. Frameworks that use Native SQL or AMDP, such as SADL, have to make sure that they access a replacement object rather than the database table or the database view.

  • Wherever possible, any programs that directly accessed aggregate tables or views with aggregate tables as basis tables should be modified so that they directly access the CDS views that are used as replacement objects. However, this cannot usually be done by simply replacing the data source in the relevant SELECT statements. This is because a client-specific CDS view does not have a client column and therefore the used target objects no longer match. Furthermore, if a CDS view is accessed directly, the CDS roles defined for it also have an effect.

  • Replacement objects cannot be defined for the following:

Executable Example

Replacement Object for Database Table


Replacement Object for Database Table