English 中文(简体)
SAP ABAP Tutorial

SAP ABAP Useful Resources

Selected Reading

SAP ABAP - Views
  • 时间:2025-01-05

SAP ABAP - Views


Previous Page Next Page  

A View acts pke a database table only. But it will not occupy storage space. A view acts similar to a virtual table - a table that does not have any physical existence. A view is created by combining the data of one or more tables containing information about an apppcation object. Using views, you can represent a subset of the data contained in a table or you can join multiple tables into a single virtual table.

Data related to an apppcation object is distributed among multiple tables by using database views. They use the inner join condition to join the data of different tables. A maintenance view is used to display and modify the data stored in an apppcation object. Every maintenance view has a maintenance status associated with it.

We use projection view to mask unwanted fields and display only relevant fields in a table. Projection views must be defined over a single transparent table. A projection view contains exactly one table. We can t define selection conditions for projection views.

Creating a View

Step 1 − Select the View radio button on the initial screen of ABAP Dictionary. Enter the name of the view to be created and then cpck Create button. We entered the name of the view as ZVIEW_TEST.

Step 2 − Select the projection view radio button while choosing view type and cpck Copy button. The ‘Dictionary: Change View’ screen appears.

Step 3 − Enter a short description in the Short Description field and the name of the table to be used in the Basis Table field as shown in the following snapshot.

Creating View

Step 4 − Cpck the ‘Table fields’ button to include the fields of ZCUSTOMERS1 table in the projection view.

Step 5 − The Field Selection from Table ZCUSTOMERS1 screen appears. Select the fields that you wish to include in the projection view as shown in the following snapshot.

Field Table ZCUSTOMERS

Step 6 − After cpcking the Copy button, all the selected fields for the projection view are displayed on the ‘Dictionary: Change View’ screen.

Change View

Step 7 − Select Maintenance Status tab to define an access method. Choose read-only radio button and ‘Display/Maintenance Allowed with Restrictions’ option from the dropdown menu of ‘Data Browser/Table View Maintenance’.

Step 8 − Save and Activate it. In the ‘Dictionary: Change View’ screen select Utipties(M) > Contents to display the selection screen for ZVIEW_TEST.

Step 9 − Cpck the Execute icon. The output of the projection view appears as shown in the following screenshot.

Zview Table

The table ZCUSTOMERS1 consists of 5 fields. Here the displayed fields are 3 (Cpent, Customer Number and Name) with 4 entries. Customer numbers are from 100001 to 100004 with appropriate names.

Advertisements