ViewsPost2 (1)
ViewsPost2 (1)
Contributed by
Sana Shaikh
Under the guidance of TagSkills
.SAP ABAP data dictionary is a central and structured source of data for
development of objects. It is a database independent DDL (Data Definition
Language) and mainly deals with create, edit, drop the database tables. In data
dictionary you can define and maintain objects which are related to database. The
ABAP data dictionary can be easily integrated with the ABAP workbench, so all
the components of workbench can be easily access the definitions stored in the
ABAP dictionary.
T-code for ABAP dictionary is se-11.
The important objects of data dictionary are as follows.
1. Database tables
2. Domains
3. Data elements
4. Views
5. Search helps
6. Lock Objects
o ABAP views in data dictionary are logical data sets which contain data
extracted on one or more tables as a single entity. A view on one or
more tables refer as the data from a view is not stored in physically
manner as the data being derived from one or more tables. It is a time
consuming process to extract the data from several tables, in order to
simplify the process and increase efficiency of code, you can define a
view
o Inner Join
o In an inner join, only those records or data will be selected that have
some matching key fields.
o The unmatched data will not be selected for the view.
o Outer Join
o In outer join, all the data of the first table will be displayed, and from
the other tables, only the matching record will be displayed.
o If there is no matching record in other tables, then the view will show
the record with blank values.
In ABAP DDIC, there are four types of views that differ from each other in a way
in which they are implemented and access the data. These are given below:
1. Database view
2. Projection view
3. Help view
4. Maintenance view
Database Views:
Projection Views:
Help Views:
o The help view is created on two or more than two tables, specifically for
the "Search-helps" in DDIC, and we cannot execute it directly.
o It combines the data by using an outer join
Maintenance Views
o The maintenance view is created on two or more tables by using the outer
join concept in DDIC.
o It allows us to maintain and read the data of the table.
o This view is suitable for the custom tables (z or y) only and should not be
used with the Standard SAP tables, as it may create the inconsistency
problem while changing the record.
o It allows us to maintain the data of several tables for one application at a
time.
Below are the steps used to create the database view in SAP ABAP:
Step-1: Open the data dictionary initial screen by navigating the menu path or
entering the transaction code SE11 in the command field.
Step-2: Click the radio button in front of View option, and give a name to the
view then click the Create button given on the screen.
In the above screen, first, we will select the Table/Join Conditions tab and will
provide the table names (base tables) that we want to link. In our example, we
will take two SAP standard tables that are MARA and MARC. After entering
the table name, we need to click on the Relationships button. Consider the below
image:
Step-8: Once we will select the MARC table, all the join conditions field names
will be filled automatically. Consider the below image:
Step-10: To select the fields of each table, we need to click on the Table
fields button given on the screen (See the above image). It will open a new pop
window with both table names (MARA and MARC). We will select one table at
a time and will select the required fields of each table.
Step-11: Once we click on the Choose button given at the bottom of the screen,
it will open all the fields of the selected table from where we can select the
required fields. Consider the below image:
Step-12: After selecting all the required fields of both tables, save the view as a
local object and activate the view (CTRL+F3) or by clicking on the
activate button. Consider the below image:
Step-14: Now, we can display the records that we have selected using the
database view. For this, click on the Content (CTRL+SHIFT+F10) option given
at the screen. Once we click on the content option, it will open the selection screen
as given in the below image:
Let's consider an example to understand the use of the projection view. Suppose
we have Students Details table, which contains records such as Student Name
and Roll number, Student address, Student fees, etc. We only want to share
student name and roll number with some companies. In this case, we will use the
projections view of the Student Details table. Hence, if there is a huge amount of
data, but we only want to display the relevant data field, we can choose the
projection view as the perfect option.
o
Dictionary: Maintain Screen Appears, consider the below image:
o Step-4: Here, we have provided the short text for an explanation of view
in the "Short Description" field, and entered the table name
"ZEMPLOYEE"(we have created in the table creation)that we are going to
use, in the Base Table Consider the above image. After entering the
details, we need to save (CTRL+S) it as the local object or within a
package. We are saving it as a local object.
o Step-6: Click on Table fields button, and select the required fields that you
want to display in the output. Click the Copy button, and all the selected
Here, we are choosing the EMPID and FULLNAME fields from the table. These
fields will appear under the Field Name option.
As we can see in the above output image, only two fields are displaying here that
we have selected in the table.
o We can either enter the details or can click on the execute or F8 given on
the above screen for displaying all the records of the selected field.
Consider the below image:
Note: A table can only be used as a selection method using the help view if
we use the outer join to retrieve the data from the database.
The ABAP help view can be understood using the below diagram.
o Step-1: Open the data dictionary initial screen by navigating the menu path
or entering the transaction code SE11 in the command field.
o Step-2: Click the radio button in front of the View Give a name to the
view, and click on the Create button, given on the screen.
o Step-3: A pop-up window will appear with all the views, from where select
the "HELP view," and click on the Copy
o Step: 6: Place the cursor on the primary table name and press
the Relationship A screen will appear, select the checkbox in front of the
primary table's name, and click on the copy button. In our case, the
secondary table is zstudent_sub, so it is inserted here.
If needed, we can add more tables in the help view, but the other tables must be
linked to each other with the foreign key relationship.
o Step: 8 Select the Table Fields button, and a list of tables contained in this
view is displayed, as shown in the above diagram. From here, we can select
any table, and then need to click on the Choose. All the selected fields will
o Step: 9 Select the Maint. Status tab and set the read-only radio button
under the Access group
We can delete the help view if we don't need it further. To delete the view,
perform the below steps:
o Open the ABAP dictionary initial screen, and choose the view radio
button.
o Enter the name of the view that needs to be deleted.
o Choose the where-used list (), and check for those tables, where the view
is currently being used.
o Select the Delete icon to the view. A box will prompt out to confirm the
deletion.
o Click to yes, to confirm the deletion of the view.
o Once you confirm it, the view will be deleted from the system.
As we can see in the above diagram, the fields F2 and F4 of table 1 and table 2
are linked with the foreign key. Similarly, the fields F5 and F6 of table 2 and table
3 are connected with the foreign key. The maintenance view is implemented on
these three tables and extracting data from F1, F2, F3, F5, and F8 fields.
o Step-3: A pop-up window will appear with all the views, from where select
the "Maintenance view," and click on the Copy
o Step-4: Provide the short text for an explanation of view in the "Short
Description" field. E.g., Creating a maintenance view for
test or Maintenance view example.
o Step- 5: Click on the Table/Join Conditions tab, provide the name of the
primary table for view under the Table column.
o Step-6: Place the cursor on the name of the primary table name and click
on the Relationships
o Step- 7: Tick on the checkbox in front of the table name.
o Step-8: Click on the copy button, and the secondary table will be selected.
o Step-9: Go to the selection conditions tab and provide the conditions. (If
required). Here we are not providing any selection condition.
o Step-10: Go to the View fields tab, click on the Table Fields button to
select the field from each table(primary and secondary).
Repeat the process for the secondary table (ZSTUDENT) also, and all the selected
fields will be displayed under the view field column.
o Step-11: Go to the Maint. Status tab and select the appropriate radio
button. Select the other fields, as shown in the below image:
o Step-13: Click on Save, Save the view as the local object or under a
package. Here we will save it as a local object. Check for any inconsistency
and Activate the view.
Here we are changing the Name ANDRICK to ARMAN, which has changed
successfully. Consider the below image: