Table of Contents
Maintenance View in SAP ABAP
As the name suggest, a Maintenance View in SAP ABAP is a view that is used to maintain data of multiple tables, altogether. The view automatically distributes data to the respective tables connected to it.
Like Database & Help view, here too we can see data altogether added we can maintain data here.
If you want a read only view just with inner joins, go with Database View and if you want a view from single table, go with Projection View and if you want a read only view with outer joins, go with Help View. And if you want a view with outer join which you can view as well as edit, then go with Maintenance View.
A Maintenance View in SAP ABAP is a view that combines multiple tables into a single view using outer join and is mainly used to maintain multiple tables altogether.
*NOTE: The Join Conditions can be only chosen via tab.
It means you need to create foreign key relationship in advance. To know how to create a Foreign Key Relationship click here.
For basics of Views Click Here.
Creation of Maintenance View in SAP ABAP:
Step 01: Open SE11, select Views radio button, and enter a name for your view e.g. ZBARRY_MAINTAIN_VIEWS and click CREATE. Choose Maintenance Views from radio buttons.
Step 02: Write an explanatory short text e.g. Help View for Employee ID.
Step 03: Write all your primary table names you want in your view in column Tables.
*NOTE: Only tables linked with Primary table (via Foreign Key Relationship) can be included in the view.
Step 04: Now you need to provide Join Conditions. Select your Primary Table and click ; it will fetch the foreign key relationship. Choose and copy the Relationship. The Join Condition derived from the relationship will be displayed as shown below. [To know more about Foreign Keys CLICK HERE].
*NOTE: Only the Relationship made with N:1 cardinality will be available. To know more about View Restrictions CLICK HERE.
Step 05: Click View Fields and then click Table fields, Select the fields from each table that you want to be visible in your View.To know more about Joins CLICK HERE.
*NOTE: By default all the fields of Primary Table that you have provided in Step 03 will be chosen (as it is an outer join).
Step 06: Save it, check for Errors and click Activate.
Step 07: Initiate Table Maintenance Generator as we did for tables and maintain data via SM30.
*NOTE: There are more functions and additional options of Maintenance View, we will update it soon.
Advantages of Maintenance Views
- Maintenance View fetches required data from Multiple Tables and hence faster than selecting data from these tables individually.
- It maintains (Create/Update/Delete) Multiple Tables at once and hence faster than maintaining multiple tables individually.
- We can maintain Delivery Class of View separately.
*NOTE: Under Maintenance Status tab, select Page and then select Delivery Class.
- It utilizes Outer Join and hence all data from Primary table is displayed irrespective of their presence in other secondary tables.
This feature can be understood via an example that we have a view that displays an employee name with First name and Last name that are being fetched from two different tables on basis of Employee ID.
|Emp ID||First Name|
|Emp ID||Last Name|
Inner Join Output:
|Emp ID||First Name||Last Name|
Outer Join Output:
|Emp ID||First Name||Last Name|