What is View?

View is a logical representation of summarized data from one or more tables. The view structure can be defined by specifying table names and required field names from the joined tables.

View is not stored physically. View used to combine the data from one or more tables. The table fields that are not used in the view definition can be hidden which causes minimization of interfaces.

If the database view created on single table, then the insertion can be done using view also. If the database view created on multiple tables, then the view is a read only view.

The first table used to create the view is called as primary table. The other tables linked to primary table with foreign keys are called as secondary tables.

View Types -

ABAP supports four different view types and those are -

  • Database views
  • Projection views
  • Help views
  • Maintenance views

Database views -

Database views are implemented on the database and automatically create on the database when it is activated. Inner join used to create Database views. This views are defined in the ABAP dictionary.

Application programs can access the data from database view using the database interface. The data can be accessed in the ABAP program using OPEN SQL and NATIVE SQL.

Projection views -

Projection views used to hide the tables fields and used only for projection. Outer join used to create Projection views.

This view creates exactly on one table. Selection method can't be defined for projection views. No corresponding objects exists in the database for projection views.

Help views -

Help views used as a search helps selection method. Outer join used to create Help views. Search help selection method is either a table or view.

If a view required to create on database with outer join, help view used as a selection method. All the tables included in help view must be linked with foreign keys.

Maintenance views -

Maintenance view allows to maintain the data distributed on several tables for one application object for one time. Outer join used to create Maintenance views.

This view permits to maintain the data of application object together. All the tables included in maintanance view must be linked with foreign keys. Maintenance views always derived from foreign keys.


Creating View -

Step-1: Go to SE11 transaction.

Creating View

It opens ABAP Dictionary: Initial Screen.

Creating View

Step-2: Select view radio button and enter the view name. Click on "Create" button.

Creating View

Step-3: It opens "Choose View Type" popup to choose the type of the view. In this example, we are creating database view. So select "database view" radio button and click on "Copy" button.

Creating View

Step-4: Enter short description, tables information and Join conditions if any.

Creating View

Step-5: Open View Flds tab and click on the "Table fields" button to select the field from the table.

Creating View

Step-6: It opens "Base Tables" dialog with available table names. Select the table and click on "Choose" button to open the field selection screen.

Creating View

Step-7: Select the required fields from the table and click on "Copy" button.

Creating View

Step-8: Repeat step-5 to step-7 until all tables are covered for selection.

Creating View

Note! If the view is created on one table, then we can set maintenance status for the view.

Step-9: However for this case, the view is read only as we created it on more than one table.

Creating View

Step-10: Click on (Ctrl + S) or "Save" icon to save the view. System asks for the package. Enter existing package if any, or create new package.

Creating View

Once the package details entered, click on "Local object" (if it is a local structure and non transportable object) or "Save"to create the views.

Step-11: Once the view saved successfully, the "ZTC_VSALES saved" message displayed on status bar.

Creating View

Step-12: Now click on "Activate" icon or "Ctrl +F3" to activate table.

Creating View

Now, View got activated and available for all the programs.

If error messages or warnings occurred during the activation of the view, the activation log gets displayed automatically. The same activation log can navigate through menu option Utilities(M) → Activation log.

Step-13: Once the view activated, click on the Contents icon on the application bar.

Creating View

Step-14: It opens "Data browser: Selection" screen. Click on "Execute" to entire data in view.

Creating View

Step-15: Data Browser: Table ZTC_VSALES select entries screen displays with all data from the view.

Creating View

Change View -

If any information in the view updated wrongly or adding/removing any new fields from the joined tables, view definition needs to be changed. Change option is used to change the view properties and follow the below steps to change the view definition -

Step-1: Go to SE11 transaction.

Changing View

It opens ABAP Dictionary: Initial Screen.

Changing View

Step-2: Enter the view name and click on the "Change" button.

Changing View

Step-3: Click on "Save" once the information modified. Verify the below message gets displayed on status bar.

Changing View

Step-4: Click on "Activate" icon or "Ctrl +F3" to activate the new changes of the views. Verify the below message gets displayed on status bar.

Changing View

Delete View -

If we want to delete the existing view or a view is wrongly created, follow the below steps to delete view.

Step-1: Go to SE11 transaction.

Deleting View

It opens ABAP Dictionary: Initial Screen.

Deleting View

Step-2: Enter the view name and click on the "delete" icon.

Deleting View

It displays a Delete View popup for confirmation, click on "Yes" to delete the table.

Deleting View

Once the view successfully deleted, the below message displays on status bar.

Deleting View