Файл: BC430_EN_Col62_FV_Part_A4_-_ABAP_Dictionary.pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 03.04.2021

Просмотров: 2299

Скачиваний: 40

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.
background image

Unit 7

Views and Maintenance Views

Unit Overview

In this chapter, you will learn about the option of defining views and maintenance
views in the SAP system.

Unit Objectives

After completing this unit, you will 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

Create a maintenance view

Create simple maintenance views

Create complex maintenance views

Unit Contents

Lesson: Views ...................................................................174

Exercise 11: Views .........................................................185

Lesson: Maintenance Views...................................................190

Exercise 12: Maintenance Views.........................................199

2006/Q2

© 2007 SAP AG. All rights reserved.

173


background image

Unit 7: Views and Maintenance Views

BC430

Lesson: Views

Lesson Overview

Lesson Objectives

After completing this lesson, you will 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

Business Example

In order to create a simplified ABAP codin in your applications, you should create
views as an overview or as a combination of tables.

Restricted or Enhanced Views on Database Tables

Figure 71: Why do you need views?

Data for an application object is often distributed on several database tables.
Database systems therefore provide you with a way of defining application-specific
views on data in several tables. These are called views.

Data from several tables can be combined in a meaningful way using a view (join).
You can also hide information that is of no interest to you (projection) or only
display those data records that satisfy certain conditions (selection).

174

© 2007 SAP AG. All rights reserved.

2006/Q2


background image

BC430

Lesson: Views

The data of a view can be displayed exactly like the data of a table in the extended
table maintenance.

Figure 72: Structure of a View - Starting Situation

The structure of a view and selection of the data using this view will be shown
with an example.

There are two tables: SCARR and SFLIGHT. The table SCARR contains two
entries, the table SFLIGHT four entries.

The tables are first appended to one another. This results in a cross-product of
both tables, in which each SCARR table record is combined with each SFLIGHT
table record.

2006/Q2

© 2007 SAP AG. All rights reserved.

175


background image

Unit 7: Views and Maintenance Views

BC430

Figure 73: Structure of a View - Join Condition

Usually the entire cross-product is not a good selection. You should therefore limit
the cross-product with a join condition. The join condition describes how the
records of the two tables are related.

In our example, the CARRID field for SCARR is compared with the CARRID
field for SFLIGHT. The join condition is then:

SCARR-CARRID = SFLIGHT-CARRID

With this join condition, all the records whose entry in Field 1 is not identical to
the entry in Field 3 are removed from the cross product. The column for Field 3
in the view is therefore unnecessary.

176

© 2007 SAP AG. All rights reserved.

2006/Q2


background image

BC430

Lesson: Views

Figure 74: Structure of a View - Field Selection (Projection)

Often some of the fields of the tables involved in a view are of no interest. You
can explicitly define the set of fields to be included in the view (projection).

In our example, the PLANETYPE field is of no interest and can therefore be
hidden.

2006/Q2

© 2007 SAP AG. All rights reserved.

177