Creating a Database View
Procedure
Enter an explanatory short text in the field Short text.
You can for example find the view at a later time using this short text.
Define the tables to be included in the view in the Tables field of the Tables/Join conditions tab page.
Keep in mind that you can only include transparent tables in a database view.
Link the tables with
join conditions.
If there are suitable foreign keys between the tables, you should copy the join conditions from these foreign keys (see
Foreign Key Relationships and Join Conditions).Place the cursor on a table name and choose Relationships. All foreign keys to other tables defined for this table are displayed. Select the foreign keys and choose Copy. The join condition is now derived from the definitions in the foreign key.
If you only want to see the foreign key relationship existing between two tables, you must first select these two tables (click on the first column of the input area Tables) and then choose Relationships.
On the View fields tab page, select the fields that you want to copy to the view.
Choose Table fields. All the tables contained in the view are displayed in a dialog box. Select a table. All the fields contained in this table are displayed. You can copy fields by selecting them in the first column and choosing Copy.
You can also include an entire table in the view (see
Includes in Database Views).On the Selection conditions tab page, you can (optionally) formulate restrictions for the data records to be displayed with the view (see
Maintaining Selection Conditions for Views).
The selection conditions define the data records that can be selected with the view.
With Goto ®
Technical settings, you can (optionally) maintain the technical settings of the database view.
You can define whether and how the database view should be buffered here. Proceed as for the technical settings of a table (see
Maintaining Technical Settings). Note that only the settings for buffering can be maintained for database views.On the Maintenance status tab page, select the
maintenance status of the database view.
If the view contains more than one table, the maintenance status read only cannot be altered.
Save your entries. You are asked to assign the view a development class.
You can change this development class later with Goto
®
Object directory entry.Choose .
Result
When a database view is activated, the corresponding view is also automatically created in the database if the base tables of the view were already created there.
At activation, a log is written; it can be displayed with Utilities
®
Activation log. If errors or warnings occurring when the view was activated, they are displayed directly in the activation log.If the base tables are not yet created in the database, this is recorded in the activation log. The view is nevertheless activated in the ABAP Dictionary. In this case you can create the relevant view on the database later with the database utility.
Other Options
Create documentation: You can create information about using the view with Goto
®
Documentation. This documentation is also output for example when you print the view.
Change data element of a view field: Select the Mod (Modify) column in the View fields tab page. The Data element field is now ready for input. You can enter a data element that refers to the same domain as the data element of the assigned table field here. Cancel the Mod flag if you want to use the data element of the assigned table field again.
Display view data: With Utilities
®
Contents you can determine which data can be selected with the view.
Display create statement: With Extras
®
CREATE statement you can display how the view was created in the database. The statement that was executed when the version of the view currently being edited was created in the database is displayed.
Check the definition of the view in the database: With Utilities
®
Database object
®
Check you can determine whether the definition of the view in the database is consistent with the active version of the view. With Utilities
®
Database object
®
Display you can display the definition of the view in the database.
Check the runtime object of the view: With Utilities
®
Runtime object
®
Check you can determine whether the definition of the view in the ABAP Dictionary maintenance screen is identical to the specifications in the runtime object of the view. With Utilities
®
Runtime object
®
Display you can display the runtime object of the view.
See also:
Database Views