Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

wat is view?:types of views?diff b/w them

Former Member
0 Kudos

hi helpers plz reply

bye vara

4 REPLIES 4

Former Member
0 Kudos

<b>View</b> - A view is a virtual table containing fields from one or more tables. A virtual table that does not contain any data, but instead provides an application-oriented view of one or more ABAP Dictionary tables.

The followings are different types of views:

<b>- Database View (SE11)</b>

Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched. Inconsistencies between primary and secondary table could, therefore, lead to a reduced selection set.

In database views, the join conditions can be formulated using equality relationships between any base fields. In the other types of view, they must be taken from existing foreign keys. That is, tables can only be collected in a maintenance or help view if they are linked to one another via foreign keys.

<b>- Help View ( SE54)</b>

Help views are used to output additional information when the online help system is called.

When the F4 button is pressed for a screen field, a check is first made on whether a matchcode is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.

- <b>Projection View</b>

Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.

A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.

- <b>Maintenance View ( SE54 )</b>

Maintenance views enable a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.

Also check the below link for more details.

http://help.sap.com/saphelp_40b/helpdata/en/cf/21ec5d446011d189700000e8322d00/content.htm

Regards,

Maha

Former Member
0 Kudos

view is logical collection of flieds from different tables,which logically in database

diff b/w views

database view:- more than one transparent table can be used.

-


>inner joins only be used.

-


>used for read only,no modifications

projection view:- only pool& cluster table

-


> only single table should be used

-


>no join conditions

-


> hide the fields

-


> read only

maintence view:

-


> more than one transparent table

-


> outer join should be used

-


> read,change,delete data

-


> maintain fields

-


> should have foreign key relation ship.

help view:

-


> more than one transparent table

-


> outer join should be used

-


> used as f4 help for fields

-


> read only

-


> should have foreign key relation ship.

Former Member
0 Kudos

Hi

Importance/Use of views

Join/Projection/Selection w.r.t views

Inner and Outer joins

Types of views

Database view

Projection view

Maintenance view

Help view

Importance/Use of Views



Data for an application object is often distributed on several database tables. Database systems therefore provide you with a way of defining application-specific views on the data contained in several tables. These are called views.

Data from several tables can be combined in a meaningful way using a view (join). You can also hide information that is of no interest to you (projection) or only display those data records that satisfy certain conditions (selection).


A view is a logical view on one or more tables, that is, a view is not actually physically stored, instead being derived from one or more other tables.

The data of a view can be displayed exactly like the data of a table in the extended table maintenance.

Join, Projection and Selection



CROSS PRODUCT
Given two tables TABA and TABB. Table TABA has 2 entries and table TABB has 4 entries

Each record of TABA is first combined with each record of TABB. If a join condition is not defined, the cross product of tables TABA and TABB is displayed with the view.

Join condition

A join condition describes how the records of the two tables are connected.

Inner Join and Outer Join 
The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join.
With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view.
With an outer join, records are also selected for which there is no entry in some of the tables used in the view. (ABAP allows left outer join.)

The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join.


Projection

Sometimes some of the fields of the tables involved in a view are not of interest. The set of fields used in the view can be defined explicitly (projection). In our example, Field 4 is of no interest and can be hidden.

We specify the fields which we need to show in our view by including them under the view flds tab when creating a view in the dictionary.

Selection Conditions

Selection conditions that are used as a filter can be defined for a view.

Specifying these conditions under the Selection conditions tab when creating a view in the dictionary would have an effect which is similar to specifying a where clause when writing a select query to restrict data.

View Types



Four different view types are supported. These differ in the way in which the view is implemented and in the methods permitted for accessing the view data .

Database views are implemented with an equivalent view on the database.

Projection views are used to hide fields of a table (only projection).

Help views can be used as selection method in Search help.

Maintenance views permit you to maintain the data distributed on several tables for one application object at one time.

Database Views



Database views should be created if want to select logically connected data from different tables simultaneously.
Database views implement an inner join.
Application programs can access the data of a database view using the database interface. (Just as we write select queries on database tables, we can write them for views as well.)

Includes in Database Views 

An entire table can be included in a database view. In this case all the fields of the included table will become fields of the view (whereby you can explicitly exclude certain fields).

To include one of the tables in the view, enter character * in field View field, the name of the table to be included in field Table and character * again in field Field name on the View fields tab page of the maintenance screen of the view.

You can also exclude individual fields of an included table. If you do not want to include a field of the included table in the view, enter - in field View field, the name of the included table in field Table and the name of the field to be excluded in field Field name.

Inserts with Database Views 

If a database view contains only one single table, data can be inserted in this table with the view .

You have the following options for the contents of the table fields not contained in the view:
If the field is defined on the database with NOT NULL as initial value, the field is filled with the corresponding initial value.

If the field is defined on the database as NOT NULL without initial value, an insert is not possible. This results in a database error.

If the field is not defined on the database as NOT NULL, there will be a NULL value in this field.

Projection Views



Projection views are used to hide fields of a table. This can minimize interfaces; for example when you access the database, you only read and write the field contents actually needed

For the above diagram, fields F3 and F4 are irrelevant, and therefore hidden from the projection view of the table.

Maintenance Views



A maintenance view permits you to maintain the data of an application object together.
The maintenance status determines which accesses to the data of the underlying tables are possible with the maintenance view.

Maintenance Status 
The maintenance status of a view controls whether data records can also be changed or inserted in the tables contained in the view.

The maintenance status can be defined as follows:

Read only: Data can only be read through the view.
Read, change, delete, insert: Data of the tables contained in the view can be
changed, deleted, and inserted through the view.
Read and change: Existing view entries can be changed. However, records
cannot be deleted or inserted.
Read and change (time-dependent views): Only entries whose non-time
dependent part of the key is the same as that of existing entries may be
inserted.

Help Views



Help view is created if a view with outer join is needed as selection method of a search help.

Help views are used exclusively for search helps.
A conventional database view selects data from the database using an inner join.
For a help view however, data is selected using a left outer join.
Eg-> Suppose table SCARR (Airline master table) has AA – American airlines
AB – Air Berlin
AC- Air Canada as three entries.
Table SPFLI (Flight schedule) has entries corresponding only to airlines AA (American airlines) and AB (Air Berlin).

Now if a database view were to be used as a selection method for a search help for airlines, we would only get AA and AB as possible entries because the database view implements an inner join…….If however, we were to use a help view as the selection method here, we would get AA,AB and AC as possible entries because a help view would implement a left outer join.

Restrictions for Maintenance and Help Views


There are some restrictions for selecting the secondary tables of a maintenance view or help view. The secondary tables have to be in an N:1 dependency to the primary table or directly preceding secondary table. This ensures that there is at most one dependent record in each of the secondary tables for a data record in the primary table.

Append Views



Append views are used for enhancements of database views of the SAP standard.
With an append view, fields of the base tables of the view can be included in the view without modifications. This is analogous to enhancing a table with an append structure.
An append view is assigned to exactly one database view. More than one append view can be created for a database view.

The append technique described can only be used for database views. With an append view, only new fields from the base tables contained in the view can be inserted in the view. You cannot insert new tables in the view or modify the join conditions or selection conditions of the view.

Rewar dif usefull

Former Member
0 Kudos

Hi,

A view is nothing but a virtual table. You cannot store values into a view directly.

A view can be a resultant of combination of two or more table based on their join queries. Views are created to view only the required fields,the original table might contain many felds which might not be useful to you.

Please go through this link.Hope its useful

http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm

-Bhavin P Shah