ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.04.2021
Просмотров: 2374
Скачиваний: 41
Unit 6: Changes to Tables
BC430
Figure 70: Enhancement of tables
Structures and tables that have been defined by SAP in the ABAP Dictionary can
be subsequently enhanced by the customer in the following way:
Customizing includes
With this variant, certain places within a structure or tables for enhancements
are already reserved. However, the associated Includes are first of all created
by the customer.
Appends
With this variant, any fields without previous reservation are appended to the
end of structures or tables.
Caution: Problems due to structure enhancements
Not only the enhanced structures and tables are affectted by enhancements
of this kind, but also all dependent structures that the enhancement takes
on as Include or substructure. For example, enhancements using appends,
which only have an effect at the end of the initial structure, can, for
dependent structures, also lead to adjustments within these structures.
In programs without active Unicode checking, structure enhancements
can lead to syntax and runtime errors, especially in type checks and
in connection with deep structures. In programs with active Unicode
checking, assignments, operand checks and accesses with offset and
length are also affected. Problematic here are changes if, for example,
numerical or deep components are inserted into a purely character-like
158
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Changes to Tables
structure and this leads to the structure losing its character-like character.
Enhancements are also therefore problematic, because the fragment view
is changed and checks in assignments and comparisons which are based
on this are influenced.
So that the effects pf structure enhancements are recognizable at all, structures
and tables in the ABAB dictionary are classified under
Extras -> Enhancement
category
according to the following procedure:
Level
Category
Meaning
1
Not classified
The structure does not have an enhancement
category
2
Not enhanceable
The structure cannot be enhanced
3
Enhanceable and
character-like
All structure components and their
enhancements must be character-like
4
Enhanceable and
character-like or
numerical
The structure and its enhancement cannot
contain any deep data types
5
Freely extendable
The structure and its enhancements may
contain components whose data type is
optional
Here, the elementary types C, D, N and T are describes as character-like, the
elemenatry types F, I, P and X as numerical. The deep types STRING and
XSTRING are not supported.
With structures and tables with Includes or substructures, the enhancement
categories of the Includes and substructures cannot be larger than those of the
initial structure. For example, if the initial structure contains an Include of level 4,
then levels 2 and 3 are not permitted for the initial structure.
Structure enhancements in Dictionary can also have an effect on internal
structures in ABAP programs if Dictionary structures in the source text are used
as Include or substructure. These dependencies are considered implicitly in the
ABAP program check. This does not include classified structures that contain
enhanceable Includes or substructures.
2006/Q2
© 2007 SAP AG. All rights reserved.
159
Unit 6: Changes to Tables
BC430
160
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Changes to Tables
Exercise 9: Changes to Database Tables
Exercise Objectives
After completing this exercise, you will be able to:
•
Make changes to existing objects
•
Convert tables
•
Enhance standard tables with append structures without modifying them
Business Example
After some organizational changes at the airlines, the original employee
management design is no longer appropriate.
The design of table ZFLCREW## is no longer appropriate. The field for the role
of the employee during the flight is too long.
Task 1:
Shorten one field in the ZFLCREW## table.
1.
Reduce the field length to 15 characters.
Note:
Create a new data element ZROLE## and replace the existing
data element with the new one. When you define data element
ZROLE##, do not use a domain. Instead, enter the data type and
length directly when you define the data element. Now activate
the table.
Go to change mode in the maintenance screen for table ZFLCREW##.
2.
Display the activation log. The system reminds you that shortening the field
makes it necessary to convert the table ZFLCREW##.
Task 2:
Employees with management or maintenance functions have their workplace
at an airport. Record information about how to reach these employees in table
ZEMPLOY##: a telephone number for reaching maintenance employees at the
airport and an office location or where the administrative employees work.
1.
Create an append structure for table ZEMPLOY## containing the following
information:
Continued on next page
2006/Q2
© 2007 SAP AG. All rights reserved.
161
Unit 6: Changes to Tables
BC430
Field
Data Element
ZZAirport
S_AIRPORT
ZZOffice number
S_BUREAUNO
ZZTelephone number
S_TELNO
Note:
The field names in an append structure must lie in the
customer namespace for fields. The field names must therefore
begin with ZZ or YY.
Task 3:
Create a suitable foreign key for the
Airport
field from the append structure.
1.
Define the foreign key in the maintenance screen of the append structure.
Hint:
The table for all airports is called SAIRPORT. For a complete
definition of the foreign key, you also need to verify a field in the
appended table (ZEMPLOY##).
From the maintenance screen for the table ZEMPLOY##, choose
Goto
→
Append Structure
.
2.
Execute the program BC430_CHECK with transaction SE38. The program
checks whether your solutions are correct.
162
© 2007 SAP AG. All rights reserved.
2006/Q2