Chapter 08 - ABAP Dictionary Objects-Views
Chapter 08 - ABAP Dictionary Objects-Views
Objectives
What is a View?
In its most basic form, a view simply mirrors an entire database table
We can use views to Join several tables, Project (or choose) certain fields
from one or more tables & Select (or choose) certain records from one or
more tables.
View A View C
View B
Projection
Table 1
View A
Selection
Table 2
Example:
Staff Level <= 3
View B
1 2 3 4 5
The join operation is used to combine information from multiple tables into a
single view.
Join
Table 3 Table 4
View C
Employee
Salary
ID Name Salary
ID Name …
Salary
Therefore, in order to use the join operation in SAP, you must first ensure that
the appropriate foreign key relationships exist among the tables to be joined.
Join
Primary Secondary
Table 3 Table 4
View C
Join Conditions
Database View
Projection View
Help View
Maintenance View
The database view is the only type of view in SAP that is physically created at
the database level.
Database View
Database
DB
16 ABAP Dictionary Objects: Views | Dec-2008 © 2005 IBM Corporation
IBM Global Services
Demonstration
Practice
The projection view is a logical view. In this context, the word “logical” means
that the view exists within the ABAP Dictionary but is not recognized by the
underlying database system.
Projection View
View C
Help View:
Help views can be used as selection methods for Search Helps.It might be
necessary to create a Help View if you are trying to accomplish an outer join.
Maintenance View:
These views permit maintenance of base table data. Transactions SM30 and
SE54 are provided for working with maintenance views.
SELECT *
FROM YXXEMP_V INTO WA_YXXEMP_V.
WRITE: / WA_YXXEMP_V-EMP_ID,
WA_YXXEMP_V-LAST_NAME,
WA_YXXEMP_V-FIRST_NAME.
ENDSELECT.
Demonstration
Select data from the database view created earlier and display selected data in a
report.
Practice
Select data from the database view created earlier and display selected data in a
report.
Summary
Views are used to look into one or more tables. A view does not contain data of
its own.
The projection operation is used to narrow a view’s focus to certain fields
in a table.
The Selection Operation is used to narrow a view’s focus to certain records
in a table.
The Join Operation is used to combine information from multiple tables into a
single view.
Types of Views in the ABAP Dictionary are Database View, Projection View, Help
View & Maintenance View.
The syntax to reference a view in an ABAP program is the same syntax we use to
reference a table.
Questions
What is a View ?
What is a Database view ?
What is a Projection view ?
What is a Maintenance view ?
What is a Help view ?