ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.04.2021
Просмотров: 2349
Скачиваний: 41
Unit 2: Data objects in the ABAP Dictionary
BC430
When the fields of an actual two-dimensional object are also taken into a structure
by including a view or DB tables, the data object which can be generated from this
remains flat (one-dimensional).
A so-called deep structure is always created when you used a table type to define
a component. Although this component is then two-dimensional, the other
components in the structure remain flat (one-dimensional).
Figure 11: Using Simple Structures in ABAP
The simplest form of a structure is the sequencing of fields through the use of
data elements. This always gives rise to a so-called flat structure. A data object
based on this structure type is always one-dimensional (as opposed to table-like,
two-dimensional data objects). You address the individual elements (components)
of the structure using the name of the structure, a hyphen and the name of the
components.
18
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Basic Data Types
Figure 12: Nested Structure
You can include another structured object in the structure and assign it to a
component. The one component refers to the structured object and the new data
object is now described as a nested structure.
Structures like theses can be nested into one another in any way.
2006/Q2
© 2007 SAP AG. All rights reserved.
19
Unit 2: Data objects in the ABAP Dictionary
BC430
Figure 13: Internal Tables
As soon as you insert an internal table as a structure component, this becomes
a deep structure.
You can define internal tables or ITABs using an existing line structure. Database
tables, structure definitions, views, data elements, direct type definitions or
existing table types can be used as line types.
By declaring an internal table in an ABAP program, a two-dimensional Array is
created in the main memory.
20
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Basic Data Types
Figure 14: Deep structure
A deep structure contains at least one table. The component of such a table has
its own name with which it can be addressed like a normal internal table (LOOP
AT..., INSERT... INTO TABLE, ...).
An internal table can, in turn, have a deep structure as a line type. In this way,
you can create multi-dimensional data types, as the inter-nesting of internal tables
and structure is possible several times.
Caution:
By contrast, database tables can only include flat structures.
2006/Q2
© 2007 SAP AG. All rights reserved.
21
Unit 2: Data objects in the ABAP Dictionary
BC430
Figure 15: Type Group
If you want to define global constants, you have to use a type group. The name of
the type group can only contain a maximum of five characters. In the type group,
you can define constants using the CONSTANTS statement. You can use the
predefined ABAP types or the global Dictionary types here.
To be able to use the types of a type group in a program, declare the type group
using the TYPE POOL statement. From these lines on, you can use all constants
of the type group.
The definition of a type group is a piece of ABAP code that you maintain either in
the Dictionary (SE11) or in the ABAP Editor (SE38).
Realization
:
The first statement for the type group
zmytp
is always:
TYPE-POOL zmytp
.
This is followed by the data type definition with the statement TYPES, as described
under local program data types. Furthermore, you can declare cross-program
constants using the CONSTANTS statement. All names of these data types and
constants must begin with the name of the type group and an underscore:
zmytp_
In an ABAP program, type groups must be declared with the following statement
before they are used:
TYPE-POOLS zmytp.
22
© 2007 SAP AG. All rights reserved.
2006/Q2