ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.04.2021
Просмотров: 2391
Скачиваний: 41
BC430
Lesson: Consistency Through Input Checks
Exercise 7: Consistency Through Input
Checks
Exercise Objectives
After completing this exercise, you will be able to:
•
Create fixed values
•
Set value tables to the correct context
•
Define foreign keys
•
Use the above mechanism to ensure that the data is consistent
Business Example
When you enter or change the employee master data, only consistent data, valid
airline carriers, departments, areas should be allowed.
The employees of the airlines are divided into administration personnel (A), flight
personnel (F) and service personnel (S). They are assigned to activity areas A, F
or S accordingly.
Task 1:
Divide the employees of the airlines into administration personnel (A), flight
personnel (F) and service personnel (S). Make sure that only valid activity areas
can be entered in table ZEMPLOY##.
1.
Maintain fixed values in the domain for the
AREA
field in ZEMPLOY## .
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
113
Unit 4: Input Checks
BC430
Task 2:
Define suitable foreign keys for the tables ZEMPLOY## and ZDEPMENT##
and ZFLCREW##.
Use the tables of the flight model, tables T000 (client) and SCURX (currency
code) as well as your tables to define the foreign keys.
To maintain the individual foreign keys, call the maintenance routine for the
particular tables. Select the
Fields
tab page.
Define a foreign key check for each of the following fields:
Table
Field
ZEMPLOY##
Client
Airline
Department code
Currency
ZDEPMENT##
Client
Airline
ZFLCREW##
Employee number
1.
Create foreign key ZEMPLOY##-Client as follows:
2.
Create foreign key ZEMPLOY##-Carrier.
Note:
Since you are using domain S_CARR_ID for the
Carrier
field
in ZEMPLOY##, you can use value table SCARR for the foreign
key definition.
3.
Create the foreign key ZEMPLOY##-Department code as follows:
Enter the value table ZDEPMENT## in the domain for the
Department
code
field and activate the domain.
Note:
To get a proposal for the foreign key definition, you must
change the domain for the
Department code
field in ZEMPLOY##.
This is not absolutely necessary for later foreign key definitions,
but makes the definition easier.
4.
Create the foreign key ZEMPLOY##-Currency as follows:
Note:
Since you are using domain S_CURR for field
ZEMPLOY##-Currency, you can use value table SCURX for the
foreign key definition.
Continued on next page
114
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Consistency Through Input Checks
5.
Create the foreign key ZDEPMENT##-Client as follows.
6.
Create the foreign key ZDEPMENT## Carrier as follows:
7.
Create foreign key ZFLCREW##-Employee number.
8.
Maintain the data for table ZEMPLOY## and test the effect of your foreign
key relationships.
Task 3:
Some employees of airline carriers work in travel agencies in order to sell
flights for their companies there. Enhance table ZEMPLOY## with a field that
documents the travel agency where each employee works.
Enhance table ZEMPLOY## accordingly and define the foreign key relationship.
Hint:
The table of all travel agencies is called
STRAVELAG
.
1.
Create a new field Agency in your table ZEMPLOY##.
Task 4:
Extend the ZDEPMENT## table by one field.
Each department of an airline has a head of department. The assignment between
the department and the head of the department should be mapped in the flight
model.
1.
Enhance table ZDEPMENT## with the
Dephead field
.
Note:
In our model, the personnel number identifies a person.
Therefore, the new field to be added to table ZDEPMENT## must
contain personnel numbers. The field should also refer to the domain
for personnel numbers.
Since the person to be managed in this case has a special role, you
should create a new data element and not use the one already created
for the personnel number.
Define a suitable foreign key for this field.
Note:
Use the two-step domain concept.
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
115
Unit 4: Input Checks
BC430
Task 5:
Create a text table.
1.
Create a text table ZDEPMENTT## for the ZDEPMENT## table.
Note:
This makes the department code understandable for
employees of the carrier in all countries.
For the field definition, use the data elements (Data type LONG) and
S_TEXT (Data type CHAR, 40)
2.
Define the foreign key of the
DepCode
field in the ZDEPMENTT## table.
Note:
The foreign keys for the
Client
and
Carrier
fields in the
ZDEPMENTT## table were already correctly defined by copying.
3.
Define the foreign key of the
Language
field in the ZDEPMENTT## table.
Note:
Since you are using domain SPRAS for field
ZDEPMENTT##-Language, you can use value table T002 for the
foreign key definition.
116
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Consistency Through Input Checks
Solution 7: Consistency Through Input
Checks
Task 1:
Divide the employees of the airlines into administration personnel (A), flight
personnel (F) and service personnel (S). Make sure that only valid activity areas
can be entered in table ZEMPLOY##.
1.
Maintain fixed values in the domain for the
AREA
field in ZEMPLOY## .
a)
Navigate from the table maintenance screen to the corresponding data
element and from here to the domain.
b)
Choose the
Value range
tab page and enter the following fixed values:
Fixed value
Short description
A
Administration personnel
F
Flight personnel
S
Service personnel
c)
Activate your domain.
Task 2:
Define suitable foreign keys for the tables ZEMPLOY## and ZDEPMENT##
and ZFLCREW##.
Use the tables of the flight model, tables T000 (client) and SCURX (currency
code) as well as your tables to define the foreign keys.
To maintain the individual foreign keys, call the maintenance routine for the
particular tables. Select the
Fields
tab page.
Define a foreign key check for each of the following fields:
Table
Field
ZEMPLOY##
Client
Airline
Department code
Currency
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
117