ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 03.04.2021
Просмотров: 2344
Скачиваний: 41
BC430
Lesson: Basic Data Types
Figure 7: Data Types in the ABAP Dictionary
To define data objects in the ABAP programs, you can use the above-mentioned
type definitions with the exception of the domain. The arrows show how they
can be used together.
Ideally, data elements use domains to define their technical properties. An ABAP
program cannot, however, access domains for defining data objects.
As a rule, data elements get their data types from domains. This data type can
also be derived from an integrated type.
A structure consists of components that can be elementary fields, tables and also
structures.
The line type of a table type (ITAB) can be a structured type or an elementary type.
2006/Q2
© 2007 SAP AG. All rights reserved.
13
Unit 2: Data objects in the ABAP Dictionary
BC430
Figure 8: Domain
The domains are used to manage the technical properties of data objects centrally.
Domains cannot be used directly in programs, tables, etc. The data type 'Data
element' (see below) is used here as a bridge from the technical properties to
the different data types / data objects.
Technical information comprises the following points:
Format:
In the format specifications, you will find the
Data type
and the
Number of characters
that can be entered in a dependent data object. If
the format is numeric, you can also determine a value for the
decimal
places
.
The data type is based on 24 integrated types. The most frequently used
data types are explained below:
CHAR
Character string
CHAR type fields can only have a maximum length of 255 in
tables. If you want to use longer character strings in tables, you
have to choose the LCHR data type. In structures, there are no
restrictions with regard to the length of such fields.
DATS
Date
14
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Basic Data Types
The length for this data type has been set at 8 characters. You can
define the output template by way of the user profile.
DEC
Calculation or amount field with point, +/- sign and
thousand-separator commas.
A DEC field can only have a maximum of 31 characters.
NUMC
Character string that can only contain numbers. The length of a
field of this type is restricted to a maximum of 255 characters.
Output properties:
Here, the maximum field length, including commas or decimal points,
is specified for the input and output of values.
This value is usually calculated automatically once the
number
of characters
has been assigned under Format, however, it can
subsequently be overwritten. The output format has an effect on the
output of screens and selection screens. The specifications from this
area are used when integrating a field into a screen, however, they can
be modified in the Screen Painter.
Furthermore, you can also define a conversion routine for this domain.
This serves to change the display format (e.g. place leading zeros before
before a number) when converting the content of a screen field from the
display format to the SAP-internal format and vice versa, as well as for
output using the ABAP statement WRITE. Similarly, you can also use
this conversion routine to override any unsuitable standard conversions.
For certain data types (DEC, FLTP, QUAN and CURR), the check
box
+/- sign
is ready for entry. If this is activated, the first character
of the field is reserved for the +/- sign on a screen. The output length
should be increased by 1 accordingly.
For character-based data types, you should also determine whether
lower case letters
are allowed. If this flag is not set, lower-case letters
can be entered in the respective input field, but will be transformed into
upper-case letters as soon as the entry is confirmed by the user (e.g.
ENTER key).
In addition, you can define valid value ranges that are used for input
checks. However, this subject is explained in more detail in another
part of the course.
2006/Q2
© 2007 SAP AG. All rights reserved.
15
Unit 2: Data objects in the ABAP Dictionary
BC430
Figure 9: Data Element
As well as constituting the link between domains and the data objects, data
elements also contain semantic/technical information about data objects created
from these.
The field labels for the data field can and should be maintained in the data
elements. These field labels (short, medium or long) can be displayed later on
screens or selection screens to explain the field content.
On selection screens (e.g. ABAP command
PARAMETERS
), only the long
version of the field label can be drawn from the Dictionary ( In the ABAP Editor
menu path:
Goto -> Text Element -> Selection Text => Checkbox ‚ Dictionary
Reference
).
If the field value is provided in a list, the entry from the field label is used for the
title. You also have to specify a
length
for the respective field label. This length
determines the maximum length for the field label. If you work for a company
that operates throughout the world, you can translate the field labels into other
languages (menu path:
Goto -> Translation
or the transaction SE63). When
specifying the length, remember that, in another language, the same term in the
field label might require more letters.
A search help (F4 / input help) can be appended to a data element. The subject of
search helps is dealt with in more detail in the one of the later units of this course.
Search helps can be integrated at different levels.
16
© 2007 SAP AG. All rights reserved.
2006/Q2
BC430
Lesson: Basic Data Types
In different applications, you sometimes have to enter a particular value in several
screens. To save the user having to enter the same value several times, it is
possible to assign a SET/GET parameter to the data element. In this parameter, the
value is transferred when the screen is exited. If an input field based on the same
data element exists on a subsequent screen, this value is read from the parameter
and entered in the screen field. The SET/GET parameters hold the value per
session. After the user has logged off, these values are not retained. In order to use
a SET/GET parameter, you have to enter this in table TPARA!
You can also assign an English default name to the data element. This is only
effective, however, if you use the data element as a component in BAPI structures.
These should use the default name so that component names are assigned
uniformly.
The technical properties for the data element are maintained on the
Data type
tab
page. Here, you should use mainly domains that are predestined for technical
typing. However, you can also define the data element using the same integrated
types that are used to define the domains. As a special case, you can also create
a data element as a reference type. The referenced type is not restricted here to
the type 'DATA ELEMENT'. It can be any other reference type or even a generic
reference to ANY, OBJECT or DATA. A reference of the type ANY can point
to both objects and data. The definition as a reference is the same as the type
declaration in an ABAP program “
TYPES tr_dt TYPE REF TO data
”.
Figure 10: Structures
A structure consists of components in the form of data elements, integrated types,
structure definitions of internal tables, DB table views or other existing structure
definitions.
2006/Q2
© 2007 SAP AG. All rights reserved.
17