Preface – This post is part of the ABAP Beginner series.
Table of Contents
Database View in SAP ABAP
As the name suggests Database View in SAP ABAP is a view that integrates several distributed database and helps us to view all data at one place. We can access data of Database View using SQL commands (SELECT Statements). It implements inner join for integration. It can even contain a single table without any Join statement. And if there is only table then we can maintain data also otherwise we can just read only.
A Database View in SAP ABAP is a view which combines multiple tables in to a single View and is used only to read the records.
*NOTE: If only one table is there then it can be maintained too.
For basics of Views Click Here.
Creation of Database View in SAP ABAP:
Step 01: Open SE11, select Views radio button, and enter a name for your view e.g. ZBARRY_VIEWS and click CREATE. Choose Database Views from radio buttons.
Step 02: Write an explanatory short text e.g. Views for Admin Dashboard.
Step 03: Write all your table names you want in your view in column Tables.
Step 04: Now you need to write Join Conditions or just click if you have earlier specified the foreign keys in tables; it will automatically write the Join conditions for you based on your foreign key relationship. [To know more about Foreign Keys CLICK HERE].
Example of a JOIN CONDITION.
Step 05: Click View Fields and then click Table fields, Select the fields from each table that you want to be visible in your View.To know more about Joins CLICK HERE.
Step 06: Save it, check for Errors and click Activate.
*NOTE: You can further go in technical settings of View and specify Buffer. There are more functions and additional optional of Database View, we will update it soon.
Advantages of Database Views
- Selection of Data from Views is faster than Selection of Data from individual tables.
- It helps to select data from logically connected tables.