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: 

structure & view

Former Member
0 Kudos

what is the difference between structure & view.

pls answer this question,

amruth.

2 REPLIES 2

Former Member
0 Kudos

Hi Amruth,

Structures

A structure is a user-defined sequence of data types.

It fully defines the data object.

You can either access the entire data object, or its individual components. ABAP has no predefined

structures. You therefore need to define your own structures, either in the ABAP program in

which you want to use it, or in the ABAP Dictionary.

You use structures in ABAP programs to group work areas that logically belong together.

Since the individual elements within a structure can be of any type, and can also themselves be

structures or internal tables, the possible uses of structures are very wide-ranging. For example,

you can use a structure with elementary data types to display lines from a database table within a

program. You can also use structures containing aggregated elements to include all of the

attributes of a screen or control in a single data object.

<b>Views:</b>

Views

By defining views, logical views permitting access to certain data can be created specially for the application. The structure of such a view is defined by specifying the tables and fields used in the view.

A view can be used to combine the data distributed in several tables. Fields which are not required can be masked out, minimizing interfaces.

The data of a view is derived from one or more tables, but not stored physically. The simplest form of deriving data is to mask out one or more fields from a base table (projection) or to include only certain entries of a base table in the view (selection). More complicated views can comprise several base tables, the individual tables being linked with a relational join operation.

The base tables of the view must be selected in the first step of a view definition. In the second step, these tables must be linked by defining the join conditions. It is also possible to copy the join condition from foreign key defined between the tables. In the third step, you must select the fields of the base tables to be used in the view. Selection conditions which restrict the records in the view can be formulated in the fourth step.

Four different types of view 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 mask out fields from the tables (only projection).The R/3 System implements the access to the base tables.

*

Help Views can be used as selection method in Search Helps.

*

Maintenance Views are used for business-oriented views on data. Access to the base tables is implemented using a special maintenance module which can be generated automatically from the view definition.

The join conditions for database views can be formulated using equality relationships between any base fields. The join conditions for the other view types must be obtained from existing foreign keys. Tables therefore can only be combined into a maintenance view or help view if they are linked to one another with foreign keys.

The Maintenance Status defines whether you can only read the view or whether the view data can also be maintained.

See also:

Join, Projection and Selection

Inner and Outer Join

Creating Views

Changing Views

Deleting Views

<b>Kindly award points if you found the reply helpful.</b>

Cheers,

Chaitanya.

Former Member
0 Kudos

Dear Amruth,

<b>STRUCTURES:</b>

structure (structured type) comprises components (fields). Types are defined for the components A component can refer to an elementary type (via a data element or by directly specifying the data type and length in the structure definition), another structure or a table type. A structure can therefore be nested to any depth.

Structures are used to define the data at the interface of module pools and screens and to define the parameter types of function modules.

The central definition of structures that are used more than once makes it possible for them to be changed centrally. The active ABAP Dictionary then makes this change wherever required. ABAP programs or screen templates that use a structure are automatically adjusted when the structure is changed . This ensures the greatest possible consistency of the data definition, also for complex programs.

There are Flat, nested and deep structures. A flag structure only references elementary types. A nested structure references at least one further structure, but not a table type. A deep structure references at least one table type.

<b>

VIEWS:</b>

Views are virtual tables used for vewing data from different tables.Data about an application object is often distributed on several tables. By defining a view, you can define an application-dependent view that combines this data. The structure of such a view is defined by specifying the tables and fields used in the view. Fields that are not required can be hidden, thereby minimizing interfaces. A view can be used in ABAP programs for data selection.

The followings are different types of views:

- Database View (SE11)

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.

- Help View ( SE54)

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.

- Projection View

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.

- Maintenance View ( SE54 )

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.

Best Regards,

Raj

<b>Please reward points if found helpful.</b>