Creating a Database View
Enter the name of the view in the initial screen of the ABAP/4 Dictionary, select object class Views and choose Create. A dialog box appears, in which you must choose the type of the view. Select the type Database view.
The maintenance screen for database views appears. You will see three input areas for tables, join conditions and view fields. Carry out the following actions:
You can also derive the join conditions from existing foreign keys between the base tables of the view. To do this, position the cursor on the table names and click on Relationships. All foreign keys to other tables defined for this table are displayed. If you only want too see the existing foreign key relationship between two of the tables included in the view, you must select these two tables (click on the tables in the first column of the input area).
Select the foreign key and choose Copy. The join condition is now derived from the definitions in the foreign key (see
You can enter the field names directly. If you do not know the field names, you can also copy them from the tables. To do this, position the cursor on a table and click on TabFields. The fields of the table are now displayed in a dialog box. You can copy fields from this by marking the first column and clicking on Copy.
You can also completely include a table in the view. The view then adapts itself automatically to changes in this table. If fields are inserted or deleted in the included table, these fields are automatically inserted or deleted in the view.
In order to include one of the tables in the view, you must enter * in the field Viewfield *, the name of the table to be included in the field Table and * in the field Fieldname. You can also exclude individual fields of an included table. If you do not want to include a field of the included table in the view, you must specify a - in the field Viewfield, the name of the included table in the field Table and the name of the field in the field Fieldname.
When a database view is activated, the corresponding view is also automatically created on the database if the base tables of the view are already created there. If the base tables are not yet created on 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 database view later with the database utility.
Optional Settings
You can make the following optional settings:
Select the Mod column (modify) and choose Enter. The Data element field is now ready for input. Enter the new data element there. This data element must refer to the same domain as the original data element. With the F4 help key for the Data element field, you can display all the data elements which refer to the domain of the field. If you want to assign the original data element again, it is sufficient to reset the Mod flag and choose Enter again.
The maintenance status determines how you can access the view data from ABAP programs (read only, read and change). Choose Extras
You can determine which data can be selected using the view with Utilities
With Extras
With Extras
With Extras
® Runtime object ® Check you can determine whether the definition for the view in the ABAP Dictionary maintenance is identical to the specifications in the runtime object of the view. With Extras ® Runtime object ® Display you can display the runtime object of the view.If a foreign key which was automatically included in the view definition is defined for the field of the base table, you can display it. To do so, position the cursor on the view field and choose Extras
See also:
Database Views Inserts with Database Views