Database view are created to get an application-specific view of data distributed across several database tables.
Steps to create Database view
To create the database view, we will use the two tables employee and department tables.
- execute tcode SE11
- Choose radio button view, enter view name zamarmn_dbview and click create
- From the Choose view type dialog box, choose Database view and click continue
- Enter short description, and enter table zamarmn_emp in the Tables field
- Choose Relationships button. In the dialog box, all foreign key relationships of the table zamarmn_emp to other tables are displayed. Select the relationship to table zamarmn_dept and choose Copy button.
- The join conditions are copied from the foreign key.
- Next step is to choose the desired fields from the tables into the view. Go to View fields tab.
- Choose the Table fields button. From the base tables dialog box, mark zamarmn_emp table and click Choose button.
- All the fields of table zamarmn_emp are listed. Select fields empid, firstname, lastname, salary, currency and choose Copy button. The selected fields are inserted in the view.
- Choose the Table fields button again. In the dialog box, choose table zamarmn_dept and insert field deptname as described above.
- Save, check and activate the view.
- From the menu bar click Utilities -> Contents to display the contents of the view.