+ All Categories
Home > Documents > ABAP_Creating Database Views

ABAP_Creating Database Views

Date post: 18-Feb-2018
Category:
Upload: kiran
View: 213 times
Download: 0 times
Share this document with a friend
7
7/23/2019 ABAP_Creating Database Views http://slidepdf.com/reader/full/abapcreating-database-views 1/7 Creating Database Views By Pranshu Kukreti, Infosys Introduction Database views are used to combine application data often distributed over several tables. The structure of such views is defined by specifying the tables and fields that are required. Fields which are not required can be hidden, thereby minimizing the interfaces. A view can be used in ABA programs for data selection. Following demo shows how to create database view for two database tables having foreign !ey relationship. "e will be creating a database view for below shown tables #$%&'BA() * #$%&'A++-(T. (ote that #$%&'A++-(T is foreign !ey table /dependent table0 and #$%&'BA() is chec! table /referenced table0 for field B1A(+2'3D. 3t should be !ept in the mind that we can only include transparent tables in database view. teps %. 4o to transaction 5%% 67 select radio button 89iew8 67 enter the name of the view 67 press 8+reate8.
Transcript
Page 1: ABAP_Creating Database Views

7/23/2019 ABAP_Creating Database Views

http://slidepdf.com/reader/full/abapcreating-database-views 1/7

Creating Database Views

By Pranshu Kukreti, Infosys

Introduction

Database views are used to combine application data often distributed over several tables. The structureof such views is defined by specifying the tables and fields that are required. Fields which are not requiredcan be hidden, thereby minimizing the interfaces. A view can be used in ABA programs for dataselection.

Following demo shows how to create database view for two database tables having foreign !eyrelationship.

"e will be creating a database view for below shown tables #$%&'BA() * #$%&'A++-(T. (ote that#$%&'A++-(T is foreign !ey table /dependent table0 and #$%&'BA() is chec! table /referenced

table0 for field B1A(+2'3D. 3t should be !ept in the mind that we can only include transparent tables indatabase view.

teps

%.  4o to transaction 5%% 67 select radio button 89iew8 67 enter the name of the view 67 press 8+reate8.

Page 2: ABAP_Creating Database Views

7/23/2019 ABAP_Creating Database Views

http://slidepdf.com/reader/full/abapcreating-database-views 2/7

 

:.  Below pop up screen will be displayed. elect 8Database 9iew8 and press button.

;.  Below screen gets displayed, enter suitable short description.

Page 3: ABAP_Creating Database Views

7/23/2019 ABAP_Creating Database Views

http://slidepdf.com/reader/full/abapcreating-database-views 3/7

 &.  3n 8Tables8 enter the name of the base tables which we want to include in our view. 3n this case we will

be entering tables as #$%&'BA() * #$%&'A++-(T.

<.  (e=t, we need to lin! the entered tables by specifying the fields in >oin condition. "e can also derivethe >oin conditions from e=isting foreign !eys between the base tables of the view. To do this, position

the cursor on the table names and clic! on present at the bottom.?.  Below pop up comes wherein lin!ed tables are present. elect the tables and press 8+opy8.

Page 4: ABAP_Creating Database Views

7/23/2019 ABAP_Creating Database Views

http://slidepdf.com/reader/full/abapcreating-database-views 4/7

 @.  n clic!ing copy button, >oin condition will be derived from the base tables. 3n our case, we have the

below shown conditions.

.  3n the 89iew Flds8 tab, we need to enter all the fields, we want in our view from the database tables."e can either enter the fields directly or we can copy them from base tables. ater can be achieved

by pressing button present in the tab 89iew Flds8. "e can also include completetable in a view by entering * in 89iew field8 * table name in 8Table8. 3f fields are inserted or deleted fromthis table, similar modification will be automatically made in view structure.

Page 5: ABAP_Creating Database Views

7/23/2019 ABAP_Creating Database Views

http://slidepdf.com/reader/full/abapcreating-database-views 5/7

C.  n pressing 8Table fields8 button we get a popup li!ewise shown below. +hoose the table whose fieldswe want to include in our view. Another popup will be shown select the fields we want to include andpress 8+opy8.

%.  "e repeat the above step to include below shown fields from table #$%&'A++-(T.

%%.  In above steps do not include 'MANDT' & 'BRANCH_ID' twice !"ile activatin# t"e view$ it will

lead to an error %:.  As shown, we have the below fields in our view.

Page 6: ABAP_Creating Database Views

7/23/2019 ABAP_Creating Database Views

http://slidepdf.com/reader/full/abapcreating-database-views 6/7

%;.  "e can also formulate the selection criteria using 8election +onditions8 tab li!ewise coded below.2ere we have entered the condition for account type and status. All the data in the base tablesatisfying the below condition will be selected based on other condition present.

%&.  (ow save the view by pressing button present in standard tool bar. Then activate the view with

  present in application tool bar. nce view got activated, press to see the contents. Belowscreen gets displayed, do not enter any value, >ust e=ecute it.

%<.  Because of the condition we have put on acc'typ * status fields, entries in the base table got filtered."e can see that all the entries have account type as 8+-115(T8 * status as 8E8.

Page 7: ABAP_Creating Database Views

7/23/2019 ABAP_Creating Database Views

http://slidepdf.com/reader/full/abapcreating-database-views 7/7

ummary

 Above steps demonstrate how to create database view from multiple tables having foreign !eyrelationships.


Recommended