View : A View is a logical view defined on one or more tables i.e. view is not actually physically stored but will be derived from one or more other tables.
Types of views :
There are four different types of views :
1. Database view (type D)
2. Projection view (type P)
3. Help views (type H)
4. Maintenance view (type C)
Other view types Structure view (type S) , Entity view (type E) are no longer supported as of Release 3.0.
Database view :
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.
Since the join operation is executed in the database in this case, you can minimize the number of database accesses in this way.
Projection view :
When you access the database, you only read and write the field contents actually needed by using a projection view.
Help View :
The selection method of a search help is either a table or a view. If you have to select data from several tables for the search help, you should generally use a database view as selection method. However, a database view always implements an inner join. If you need a view with outer join for the data selection, you have to use a help view as selection method.
Maintenance View :
You can display, modify and create the data of a complex application object together.
Normally the user is not interested in the technical implementation of the application object, that is in the distribution of the data on several tables.So in this case the maintenance view is helpful for easy maintenance of data.
Restrictions for selecting the secondary tables for Maintenance and Help Views :
There are some restrictions for selecting the secondary tables of a maintenance view or help view. The secondary tables have to be in an N:1 dependency to the primary table or directly preceding secondary table.
This ensures that there is at most one dependent record in each of the secondary tables for a data record in the primary table.
Types of views :
There are four different types of views :
1. Database view (type D)
2. Projection view (type P)
3. Help views (type H)
4. Maintenance view (type C)
Other view types Structure view (type S) , Entity view (type E) are no longer supported as of Release 3.0.
Database view :
- Data about an application object is often distributed on several database tables. A database view provides an application-specific view on such distributed data.
- The view defined in the ABAP Dictionary is reproduced in the underlying database and you can only define them using transparent tables.
- You can use both OPEN SQL and NATIVE SQL to access database views from ABAP programs.
- If you define a database view using only one table, you can make changes to the view. For database views containing several tables, however, only read accesses are allowed.
- Database views implement Inner join .
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.
Since the join operation is executed in the database in this case, you can minimize the number of database accesses in this way.
Projection view :
- Projection views are used to suppress certain fields from a table.
- A projection view contains exactly one table. You cannot define selection conditions for projection views.
- Unlike database view ,there is no restriction on type of the table. It is possible to access transparent/pooled tables/cluster tables with a projection view.
When you access the database, you only read and write the field contents actually needed by using a projection view.
Help View :
- Help view can be used as a selection method in search help.
- The first table to be inserted in the help view is called as the primary table of the help view. The tables added to this primary table with foreign keys are called secondary tables.
- A help view implements an Outer join, i.e. all the contents of the primary table of the help view are always displayed. You therefore should not formulate a selection condition for fields in one of the secondary tables of the help view.
The selection method of a search help is either a table or a view. If you have to select data from several tables for the search help, you should generally use a database view as selection method. However, a database view always implements an inner join. If you need a view with outer join for the data selection, you have to use a help view as selection method.
Maintenance View :
- Maintenance views are used to maintain complex application objects in an easy way.
- It implements Outer join
- All the tables in a maintenance view must be linked with foreign keys, that is the join conditions for maintenance views are always derived from the foreign key.
- You can maintain the data from the base tables of a maintenance view together using table views maintenance transaction SM30.
You can display, modify and create the data of a complex application object together.
Normally the user is not interested in the technical implementation of the application object, that is in the distribution of the data on several tables.So in this case the maintenance view is helpful for easy maintenance of data.
Restrictions for selecting the secondary tables for Maintenance and Help Views :
There are some restrictions for selecting the secondary tables of a maintenance view or help view. The secondary tables have to be in an N:1 dependency to the primary table or directly preceding secondary table.
This ensures that there is at most one dependent record in each of the secondary tables for a data record in the primary table.