Views

 VIEW is a DDIC object. It is used to join several tables to extract data from them with a common field relation.

A view is a pseudo table which doesn't occupy any space in the database. It is stored in database as a PL/SQL statement.

There are FOUR types of views.

  1. Database Views
  2. Projection View
  3. Maintenance View
  4. Help View

We rarely create views. In some situations we create only database views. Instead of views we can use SELECT statements with JOINS  in the program itself.

Database View is used to join several tables with common field relation to extract data. Table updations are not possible with these views as several tables used.

Projection View is used to retrieve certain selected fields from table to minimize load. This view always refers to one single table. Since only one table is involved , table updations are possible in this view.

Maintenance View is used to retrieve data and to perform all data manipulations like insert, Modify and Delete operations on the data. It is recommended to add all key fields to this view.

Data is maintained with this view using the transaction SM30. Special transaction should be created in SE54 to maintain this view.

Help view is used as a selection method of an elementary searching, if the selection is too complex, it is generally used to link or to extract the supplementary text explanation from secondary tables.

Example: Combining tables SCARR and SPFLI

Step1: SE11 Select VIEWS provide name ZVIEW1 click on CREATE

Step2: Select DATABASE VIEW and continue. Provide Description.

Step3: Specify tables SCARR and SPFLI

Step4: Under JOIN conditions provide key fields as follows..

SCARR       MANDT      =      SPFLI          MANDT

SCARR      CARRID     =       SPFLI           CARRID

Step5: Goto the tab View Fields provide the field names that you want to return from joined tables

MANDT      SCARR      MANDT

CARRID      SCARR     CARRID

CARRNAME SCARR   CARRNAME

CONNID       SPFLI       CONNID

CITYFROM   SPFLI       CITYFROM

CITYTO        SPFLI         CITYTO

Step6: Save-Check-Activate

Step7: In zprograms you can use this view as a database table.

 

Comments

Popular posts from this blog

Sample ABAP program for Updating notepad file data to Internal table and Sending it to Application server

OPEN SQL EXAMPLES IN ABAP – PART 2

Domains and Data Elements