Database Views 

In the relational data model, data for one application object is often distributed among several database tables. Database systems therefore permit you to define application-specific views on the distributed data.

Database views can be defined in the ABAP Dictionary. The view defined in the ABAP Dictionary is implemented with an equivalent view in the database. This view is automatically created in the database when it is activated in the ABAP Dictionary.

Application programs can access the data of a database view using the database interface. You can access the data in ABAP programs with both OPEN SQL and NATIVE SQL. However, the data is actually selected in the database.

If more than one table is contained in the view, only read access is allowed. Since the join operation is executed in the database in this case, you can minimize the number of database accesses in this way.

If the database view only contains a single table, the maintenance status can be used to determine if data records can also be inserted with the view.

Database views implement an inner join. You only get the records of the primary table for which there are also records of the secondary table that are selected with the join (see Inner and Outer Join). Inconsistencies between primary and secondary table can therefore lead to a reduced selection set.

Database views should be created if want to select logically connected data from different tables simultaneously. Selection with a database view is generally faster than access to individual tables. When selecting with views, you should also ensure that there are suitable indexes on the tables contained in the view.

Since a database view is implemented in the database, only transparent tables can be used in such a view.

Buffering Database Views

The data read with a database view can be buffered. View data is buffered completely analogously to table data (see Buffering Database Tables). The technical settings of a database view control whether view data may be buffered (see Buffering Permission) and how this should be done (see Buffering Types). The same settings are possible as when buffering tables.

The buffered view data is invalidated as soon as the data in one of the base tables of the view changes.

Includes in Database Views

It is possible to include entire tables in a database view. In this case all the fields of the included table will become fields of the view (whereby you can explicitly exclude certain fields). If new fields are included in the table or existing fields are deleted, the view is automatically adjusted to this change. A new or deleted field is thus included in the view or deleted from the view in this case.

See also:

Creating Database Views

Maintenance Status