Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
BC430_EN_Col62_FV_Part_A4_-_ABAP_Dictionary.pdf
Скачиваний:
204
Добавлен:
21.05.2015
Размер:
21.37 Mб
Скачать

BC430

Lesson: Views

Exercise 11: Views

Exercise Objectives

After completing this exercise, you will be able to:

Create views

Define join conditions

Buffer database views

Business Example

The data existing for an employee is distributed on several tables (corresponding to the relational data model). For some exercises, however, a complete view on this data is needed. In this exercise, the corresponding views are implemented by creating views.

The flight personnel (all pilots and stewards) must be selected when a flight crew is set up. Not all the data in table ZEMPLOY## may be displayed when this data is accessed; for example, the employee setting up the teams may not see the salary of the crew members. The telephone number of the employee's department should be output in case of questions.

Task:

1.Create a suitable database view ZEMPFLY## that satisfies the requirements. The following information about an employee should be displayed:

Client Airline

Personnel number First name

Last name

Telephone number of the department Department code

Note: The view should permit a view on data in tables ZEMPLOY## and ZDEPMENT##. The view should display data about employees (from table ZEMPLOY##) and departments (from table ZDEPMENT##).

2.Transfer the fields from the tables in the view.

Continued on next page

2006/Q2

© 2007 SAP AG. All rights reserved.

185

Unit 7: Views and Maintenance Views

BC430

3.Make sure that only flight personnel can be selected with the view. Define this restriction via a selection condition.

You probably will have to (frequently) access the data using the view. The selected data should therefore be buffered in order to increase performance. Choose full buffering as buffering type.

4.Buffer the view.

186

© 2007 SAP AG. All rights reserved.

2006/Q2

BC430

Lesson: Views

Solution 11: Views

Task:

1.Create a suitable database view ZEMPFLY## that satisfies the requirements. The following information about an employee should be displayed:

Client Airline

Personnel number First name

Last name

Telephone number of the department Department code

Note: The view should permit a view on data in tables ZEMPLOY## and ZDEPMENT##. The view should display data about employees (from table ZEMPLOY##) and departments (from table ZDEPMENT##).

a)In the initial screen of the ABAP Dictionary, mark object type View, enter the object name ZEMPFLY## and choose Create.

b)A dialog box appears in which you should select the view type. Mark

Database view and choose Choose.

c)Enter a short text in the next screen.

d)First enter table ZEMPLOY## in field Tables.

e)Choose Relationships. All the foreign key relationships of table ZEMPLOY## to other tables are listed. Mark the relationship to table ZDEPMENT## and choose Copy.

The join conditions are copied from the foreign key.

f)In a different mode, display the foreign key between the two tables and notice the relationship between the foreign key and the join conditions.

Continued on next page

2006/Q2

© 2007 SAP AG. All rights reserved.

187

Unit 7: Views and Maintenance Views

BC430

2.Transfer the fields from the tables in the view.

a)Select View fields.

b)Choose Table fields. In the next dialog box, mark table ZEMPLOY## and select Choose.

c)All the fields of table ZEMPLOY## are listed. Mark the fields Client,

Airline, Personnel number, First name and Last name. Select Copy. The fields are now inserted in the view.

d)Again choose Table fields. In the dialog box, choose table

ZDEPMENT## and insert fields Department telephone and Department code in the view as described above.

e)Choose Selection conditions.

3.Make sure that only flight personnel can be selected with the view. Define this restriction via a selection condition.

You probably will have to (frequently) access the data using the view. The selected data should therefore be buffered in order to increase performance. Choose full buffering as buffering type.

a)The restriction whether an employee belongs to the flight personnel is contained in field Area in the ZEMPLOY## table. Enter this in columns Table and Field name.

b)Flight personnel are identified by the value F in field Area. Therefore, enter EQ in the column Operator and 'F' in the column Compar. Value (incl. inverted commas) ein.

4.Buffer the view.

a)Choose Goto → Technical settings. The maintenance screen for the technical settings of the view appears. With the exception of some attributes that are meaningless for views and which are therefore not displayed, the screen is analogous to the corresponding maintenance screen for tables.

b)Mark Buffering switched on and Fully buffered.

c)Save the technical settings and return to the view maintenance screen.

d)Activate the view.

188

© 2007 SAP AG. All rights reserved.

2006/Q2

BC430

Lesson: Views

Lesson Summary

You should now be able to:

Judge how a view is created from tables with join, projection, and selection

Create database views

Set up a link between foreign keys and join conditions

Use views in programs for data selection

Judge when to use maintenance views

Recognize the difference between an inner join and an outer join

2006/Q2

© 2007 SAP AG. All rights reserved.

189

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]