Getting Started with ABAP: How to Create Projection View
This is the next blog post in this series. Here is the previous blog post Getting Started with ABAP: How to Create Database View Part 2
In the previous blog post, we learned how to create database view on more than one table.
In this blog post we will learn how to create projection view.
What is Projection View?
Projection view can be created on only single table. In this view only required fields are selected from a table.
Using Projection View, we can read data and maintain data of single database table.
How to create Projection View
Step 1: Go to SE11. Select view and enter the name of the view. Click on Create.
Step 2: Select Projection View and press Enter.
Step 3: Enter short description.
Step 4: As Basis table you can enter only one table name. Enter the table name.
Step 5: Click on Table Fields.
If you want to maintain data into database table through Projection View then you need to select all key fields of the table.
Here I selected 4 fields from the table.
Step 6: All selected fields will get added in projection view.
Step 7: Select Maintenance Status tab. You can see there are two options in Access.
I want to maintain table hence I selected read and change.
Step 8: Save and Activate it. Click on Contents and Execute.
Step 9: Data is present in the database will be display through projection view.
Step 10: You can add entries by clicking on Create.
Step 11: Enter data and save.
Step 12: Here you can see entry is added. You can check your database table.
Step 13: If you want to edit entries just select that entry and click on Change.
Step 14: You will be able to edit field value except key fields. Save it.
Step 15: You can check your database table whether value is changed or not.
Step 16: If you want to delete entry select that entry and right click on it. Select Delete.
Step 17: Click on Delete Entry.
Step 18: Check your database table.
Here we have created projection view. Also, we learned how to maintain data through Projection View into database table.
Here you can check next blog post Getting Started with ABAP: How to Create Maintenance View
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.
I always wondered:
Is there any valid use case for a projection view?
When all required fields are present in one database table that time we use projection view. But always question is there then what is the difference between database view and projection view ?
Generally database view is used when all required fields are present in multiple tables. And when all required fields are present in one table then we go for projection view.
But it didn't answer my question.
My question was if there is any reason to use a projection view at all?
Yes, there is a reason. We can access pool, cluster and transparent tables using this projection view and on only one table we can create this view.
But in case of database view we can only acess transparent tables.
And have you ever required to create a projection view for a cluster/pool table (or even a transparent table)?
What was the purpose of it?
Till now i have not used projection view.
The purpose of projection view is restrcting the access to data of single table.
For example, if i want that certain group of people can only able to see suppose data of 10 fields of the table, I dont want them to see entire data of the table. I want to restrict the access to see the data present in that table.
That is the purpose of view.
While it does make sense theocratically, I haven't ran into such use case in real life.
(This would require at least maintaining authorizations for authorization object S_TABU_NAM in table-level, which isn't feasible for daily usage).
A projection view is only when it makes sense to group some fields of one table, from functional perspective (and so makes it valid also for authorizations if used via SM30), and it will be used by several programs (otherwise that would make a lot of overhead for no good reason).
I doubt that beginners would ever need creating a projection view. I guess it's more used by SAP or by big third-party software companies.
Note that I think it's not the goal of the blog series "Getting Started with ABAP" to explain why and when things are needed, what are possible alternatives, it's more a series to make beginners practice SAP GUI and ABAP transaction codes. Later, they will learn better practice by themselves or from experimented people.
For information, I created a projection view also from technical perspective, to mass update few fields of lots of lines, to reduce the memory usage of the internal table (UPDATE projection_view FROM TABLE itab).