Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
ABAP

Database view

 

Data about an application objects are often distributed on the several database tables. Say, for example the purchase order details are distributed in tables like EKKO, EKPO and so on.

 

Database view provides the application specific view on such distributed data in a single view.

 

Application programs can access the data of a database view using the database interface. You can access the data in ABAP programs with both OPEN SQL and NATIVE SQL. However, the data is actually selected in the database. Since the join operation is executed in the database in this case, you can minimize the number of database accesses in this way. Database views implement an inner join.

 

clip_image002

 

 

 

 

 

Note: With database view we can only view the data and cannot modify the data.

 

Step1: Go to the Tcode SE11 and enter the name of the view you want to create and click on create (F5).

 

clip_image004

 

 

Step 2: Choose the type of view you wanted to create.

 

clip_image006

 

 

Step 3: Enter the short description for the view

 

clip_image008

 

 

Then provide the list of tables for which you wanted to create a view.

 

Keep in mind that you can only include transparent tables in a database view.

 

Here I am going to create a database view to see the combined data of the table EKKO and EKPO.

clip_image010

If there are suitable foreign keys between the tables, you should copy the join conditions from these foreign keys

 

Click on the relationship the system will propose you the relationships between these tables.

 

Choose the relationship between the tables and press COPY.

 

clip_image012

 

The system will generate the join conditions.

 

clip_image014

 

Step 4: In the view fields tab select the fields that you want to copy to the view which you can also choose from the table fields.

 

clip_image016

 

After clicking on the table field choose the table from where you want to select the fields.

clip_image018

 

Select the fields in the table and press copy.

clip_image020

 

clip_image022

 

 

Similarly add some fields from the EKPO Table.

 

clip_image024

 

 

Step 5: In the selection condition specify the condition for which you want the view to display the data.

 

clip_image026

 

Step 6: In the Maintain status tab, set the maintenance status.

 

clip_image028

 

Save and activate the application.

 

Go to -> Technical settings and maintain the setting you want. The technical settings control whether the view should be buffered or not.

 

Step 7: View the contents using ctrl+shft+f10 or clip_image030

 

clip_image032

 

 

Execute to see the output.

 

Output:

 

clip_image034

 

Records will be displayed for the selected fields from the EKKO and EKPO table and for the conditions which we have written.

 

 

About Arun

0 Comments:

Post a Comment

Powered by Blogger.