ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.04.2021
Просмотров: 2361
Скачиваний: 41
Unit 2: Data objects in the ABAP Dictionary
BC430
The data type attributes of a data element can also be defined by specifying a
built-in type
, where the data type and number of places is entered directly.
Figure 18: Two-Level Domain Concept: Example
The flight schedule is stored in table SPFLI. Table fields AIRPFROM (departure
airport) and AIRPTO (arrival airport) have the same domain S_AIRPID. Both
fields use the same domain because both fields contain airport IDs and therefore
have the same technical attributes. They have a different semantic meaning,
however, and use different data elements to document this. Field AIRPFROM uses
data element S_FROMAIRP and field AIRPTO uses data element S_TOAIRP.
Figure 19: Transparent Tables and Structures
48
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Tables in the ABAP Dictionary
A transparent table is automatically created on the database when it is activated
in the ABAP Dictionary. At this time, the database-independent description of
the table in the ABAP Dictionary is translated into the language of the database
system used.
The database table has the same name as the table in the ABAP Dictionary. The
fields also have the same name in both the database and the ABAP Dictionary.
The data types in the ABAP Dictionary are converted to the corresponding data
types of the database system.
The order of the fields in the ABAP Dictionary can differ from the order of the
fields on the database. This permits you to insert new fields without having to
convert the table. When you add a new field, adjust the order of the fields by
changing the database catalog (ALTER TABLE). The new field is added to the
database table.
ABAP programs can access a transparent table in two ways. One way is to access
the data contained in the table with OPEN SQL (or EXEC SQL). With the other
method, the table defines a structured type that is accessed when variables (or
more complex types) are defined.
You can also create a structured type in the ABAP Dictionary for which there is no
corresponding object in the database. Such types are called
structures
. Structures
can also be used to define the types of variables.
Figure 20: Include Structures
Structures can be included in tables or other structures to avoid redundant structure
definitions.
A table may only be included as an entire table.
2006/Q2
© 2007 SAP AG. All rights reserved.
49
Unit 2: Data objects in the ABAP Dictionary
BC430
A chain of includes may only contain one database table. The table in which you
are including belongs to the include chain. This means that you may not include a
transparent table in a transparent table.
Includes may contain further includes.
Foreign key definitions are generally imparted from the include to the including
table. The attributes of the foreign key definition are passed from the include to
the including table so that the foreign key depends on the definition in the include.
Figure 21: Technical settings
You must maintain the technical settings when you define a transparent table in
the ABAP Dictionary.
The technical settings are used to individually optimize the storage requirements
and accessing behavior of database tables.
The technical settings can be used to define how the table should be handled when
it is created on the database, whether the table should be buffered and whether
changes to entries should be logged.
The table is automatically created on the database when it is activated in the
ABAP Dictionary. The information required here about the storage area to be
selected (tablespace) and the expected table size is determined from the settings
for the data class and size category.
The settings for buffering define whether and how the table should be buffered.
You can define whether changes to the table entries should be logged.
50
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Tables in the ABAP Dictionary
Figure 22: Fragmenting the tables in the database
Particularly tables that include transaction data can have large gaps in ther
allocated memory space due to the fast growth or frequent changing of the datasets
(inserting and deleting of data records). This fragmenting of the data on the hard
drive of the database server always leads to repeated performance problems, which
can
not
be removed by simple measures such as creating an index.
Fragmented indexes can be defragmented by simply deleting them and then
entering them again. Here, the database calculates the content and the structure
of the index again and creates the necessary memory space in one piece in the
storage medium, where possible. While the index is being newly structured, the
database tables can still be used.
Caution:
If the index originates from a large table ( < 100.000 data
records ), the creation process may take several minutes or even hours
(for tables in the BW environment). Furthermore, while recreating the
index, this cannot be used for database access, which would lead to an
additional load (Full Table Scan) on the database when data records are
read from the respective tables.
Fragmented tables must be converted (see Changes to database tables), in order
to reduce the fragmentation. The SAP system creates a new table for this. The
data are transferred to this table. The old table is then deleted and the new table
replaces it. If this table should unexpectedly grow very quickly, this table should
be checked once again before converting the technical settings and adjusted
if neccessary.
2006/Q2
© 2007 SAP AG. All rights reserved.
51
Unit 2: Data objects in the ABAP Dictionary
BC430
Caution:
During the converison process, the content of the table cannot be
read or changed. The conversion process of a table must be executed in a
productive environment with the greatest of care, as, depending on the size
of the table, the conversion process can last for several minutes or hours.
= > Such conversion processes (for tables or indexes) should therefore
take place in times with the least load.
In order to avoid such fragmentations as much as possible from the start, you
select the tables according to size and data type in the technical settings.
Figure 23: Data class
The data class logically defines the physical area of the database (for ORACLE
the tablespace) in which your table should be stored. If you choose the data class
correctly, the table will automatically be created in the correct area on the database
when it is activated in the ABAP Dictionary.
The most important data classes are
master data, transaction data,
organizational data
and
system data
.
Master data is data that is only seldomly modified. An example of master data is
the data of an address file, for example the name, address and telephone number.
Transaction data is data that is frequently modified. An example is the material
stock of a warehouse, which can change after each purchase order.
Organizational data is data that is defined during customizing when the system
is installed and that is only seldomly modified thereafter. The country keys are
an example.
52
© 2007 SAP AG. All rights reserved.
2006/Q2