

Getting Started with ABAP: How to Create View Part 2
source link: https://blogs.sap.com/2022/06/23/getting-started-with-abap-how-to-create-view-part-2/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Getting Started with ABAP: How to Create View Part 2
This is the next blog post in this series. Here is the previous blog post Getting Started with ABAP: How to Create View Part 1
In the previous blog post, we learned how to create database view on single database table.
In this blog post we will learn how to create database view on two tables.
How to Create Database View on more than one table
If you create database view on more than one table then you can only read the data through database view.
Step 1: Go to SE11. Select View and enter view name that you want to create.

Step 2: Click on Create. Select Database View.

Step 3: Enter short description.

Step 4: Here I want data from two tables hence I need to join two tables here. So, enter both tables name in Table column.
I have two tables one is employee table (ZAKTABLE) and second one is department table (ZAK_DEP).
My tables are:
ZAKTABLE

ZAK_DEP

First, I entered one table.

Step 5: Click on Relationships.

Step 6: You will get the name of second table. Select that table. You can see that join condition will get added. Join condition means in both table employee id field is common so based on that field we will join this two tables.

Step 7: Select View Fields tab.

Step 8: Click on Table Fields.

Step 9: Select first table name. Then you will get below window.

Step 10: Select fields from table that you want in result set. Here I selected 3 fields. And click on copy.
Note: You have to select all key fields from the table. Otherwise you will get error stating that key field is missing.

Step 11: You will get below window. Click on Table Fields.

Step 12: Select fields from second table. Here I selected 3 fields. MANDT and EMPLOYEE_ID fields are already selected hence no need to select it again.

Step 13: Click on Copy.

Step 14: In selection condition you can put condition that you can see in previous post.
In Maint.Status you can see that you can not change access. You can only read data because you are creating view on two tables.

Step 15: Save and Activate View.

Step 16: Click on Contents. Here you can see that data from two tables.

Here we have created database view.
In this way you can add more than two tables and create database view.
In this blog post we learn how to create database view on two transparent tables.
Follow my profile to be notified of the next blog post. Please feel free to ask any questions you have in the comments section below.
Recommend
-
7
Mamikee Kanneh October 14, 2021 5 minute read
-
1
Anuja Kawadiwale June 12, 2022 3 minute read...
-
3
Getting Started with ABAP Core Data Services (CDS) 12 107 95,336 This p...
-
7
This is the fourth blog post in this series. Here is the previous blog post Getting Started with ABAP: Data Dictionary Introduction
-
11
Anuja Kawadiwale June 19, 2022 2 minute read...
-
9
Anuja Kawadiwale June 20, 2022 2 minute read...
-
8
Anuja Kawadiwale June 24, 2022 3 minute read...
-
4
Anuja Kawadiwale June 26, 2022 4 minute read...
-
2
Anuja Kawadiwale June 29, 2022 4 minute read...
-
4
Getting started with View Transitions on multi-page apps May 18, 2023 Spurred by
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK