Preface – This post is part of the ABAP Beginner series.
Table of Contents
Views in ABAP
Have you ever seen the views outside your window? Let’s suppose that a beautiful girl leaves just in front of your house with her parents. Now suppose you have a big window in your room from where you can see windows of both the girl and her parents. If you just want to see the girl, then you can use curtains to hide one part of the window, if you want to check her parents’ activity you can move the curtains again. That is Views in ABAP.
Views in ABAP helps us to see what we want to see from one table or many.
A View is a reusable object which doesn’t stores any data physically but is derived from one or more tables.
Mandatory steps to make Views in ABAP
Step 01: Open SE11 and choose Views Radio Button. Enter the name and Type of the View
Step 02: Select the tables for view.
Step 03: Link tables using Join Conditions.
Step 04: Select the fields from tables; these will be only visible in the views.
Step 05: Define the selection conditions which will restrict the records in the view.
Types of Views
|A View that integrate multiple Table into a single View.
|A View that shows only few fields of single Table.
|A Search Help can show data from Table or Structure. But if you need data from multiple tables then we create a Help View for Search Help.
|Unlike Database View where you can only View Data, if you want to maintain multiple Table @ a single place using View then we create Maintenance Views.
*NOTE: To know more about Joins click here.
Requirement: You have three tables of Employee:
- ZEMP_DETAILS that have Employee Details like Employee ID, USERNAME, PASSWORD, NAME, and Date of Birth.
- ZEMP_ADDRESS that have Employee Details like Employee ID, Employee Address, Town, State, and Country.
- ZEMP_SALARY that have Employee Details like Employee ID, Employee Basic Salary, Allowance and Tax.
Now you want to view all the details of an employee altogether. What will you do?
Proposed Solution: We will create a view which will be based on Employee ID.
From above View we can see how we can project multiple tables altogether.