Anda di halaman 1dari 13

Cross-program (globally known) data types can be defined in the ABAP

Dictionary. You can refer to these data types in every ABAP program in the
SAP system with the TYPE addition for the corresponding ABAP statements.
On the ABAP Dictionary: Initial screen, in the Data Type field you can find
the following basic types:

 Data element
 Structure
 Table type
You can use the type definitions shown in the figure (with the exception of the
domain) to define data objects in ABAP programs. The arrows show how the
type definitions can be used together.
Data elements use domains or integrated types to define their technical
properties. However, an ABAP program cannot access domains to define data
objects.

Domains
A Domain comprises the following settings:

 Format
In the format specifications, you will find the data type and the number of
characters that can be entered in the dependent data object. If the format is
numeric, you can also specify the number of decimal places.
The data type must be chosen from a built-in list of data types.
The following are the most frequently used data types:

 CHAR (Character string)


Fields of this type can have a maximum length of 255 characters in
tables. To use longer character strings in tables, you have to choose the
LCHR data type. In structures, there are no length restrictions regarding
these fields.

 DATS (Date)
The length for this data type is set to eight characters. You can define
the output template with the user profile.

 DEC (Decimal)
A DEC field can have a maximum of 31 characters. This field is the
calculation or amount field with decimal point, +/- sign, and thousands
separators.

 NUMC (Numeric)
The length of NUMC field is restricted to a maximum of 255 characters.
This character string can only contain numbers.

 Output characteristics
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, you can overwrite it later. The
output format affects how screens and selection screens are displayed. The
specifications from this area are used when a field is integrated in a screen.
However, they can be modified in the Screen Painter.
You can also define a conversion routine. This conversion routine changes
the display format (for example, place leading zeros before a number) when
the content of a screen field is converted from the display format to the SAP-
internal format and vice versa. The same conversion routines are executed
by the system when you use the ABAP statement WRITE. Similarly, you can
also use this conversion routine to override any unsuitable standard
conversions.
For certain data types such as 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. Accordingly, the system
increases the output length by 1.
For character-based data types, you should also determine whether
lowercase letters are allowed. If this flag is not set, you can enter lowercase
letters in the respective input fields; however, the lowercase letters will be
transformed into uppercase letters as soon as the user confirms the entry
(for example, the ENTER key).
In addition, you can define valid value ranges that are used for input checks.

AUDION TRANSCRIPT
Domains manage the technical properties of data elements centrally. Domains cannot
be used directly in programs, tables, and so on.
Data Elements
A search help (F4 key or input help) can be appended to a data element. The subject
of search helps is discussed in greater detail later in this course. Search helps can be
integrated at different levels.
Audio Transcript
Data elements actually define data types which can be used on screens, search
helps, ABAP programs and complex data types.
Data elements allow you to maintain field labels. These field labels (short,
medium, or long) can be displayed on screens or selection screens to explain
the field content.
You also have to specify maximum length for the respective field label. If you
work for a company that operates globally, you can translate the field labels into
other languages. (On the ABAP Dictionary, choose Goto → Translation, or run
the transaction code SE63.) When specifying the maximum length, remember
that the same term in the field label might require more letters in another
language.
A search help (F4 key or input help) can be appended to a data element. The
subject of search helps is discussed in greater detail later in this course. Search
helps can be integrated at different levels.

SET/GET Parameter
Assigning a SET/GET parameter to the data element saves the user from
entering the same value several times. When you exit the screen, the system
transfers the value into this parameter. If an input field based on the same data
element exists on a subsequent screen, the system reads the value from the
parameter and enters it in the screen field. The SET/GET parameters hold the
value for each session. These values are not retained after the user has logged
off.
The SET/GET parameters have nothing to do with the SAP GUI history (local
data). You can also assign a default name to the data element. However, this is
only effective if you use the data element as a component in Business
Application Programming Interface (BAPI) structures.
The technical properties for the data element are maintained on the Data Type
tab page. It is recommended to use domains to specify the technical type of a
data element. 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 may
be any type defined in the dictionary or a generic reference to types ANY,
OBJECT, and 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.

AUDIO TRANSCRIPT
In different applications, you may need to enter a particular value in several screens.

---
A structure consists of components in the following forms:

 Data elements
 Integrated types
 Table types
 Definition of database tables and database views
 other structure types
When the fields of an actual two-dimensional object are integrated in a structure
by including a view or DB tables, the data object that can be generated from this
structure remains flat and is one-dimensional.
A deep structure is always created when you use a table type to define a
component. Although this component is then two-dimensional, the other
components in the structure remain flat (one-dimensional).
The simplest form of a structure is a list of fields typed with data elements. This form of
a structure is called a 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.
You can include another structured object in the structure and assign it to a
component. The component refers to the structured object and the new data object is
described as a nested structure.
A dictionary structure containing one or more fields using a table type is called a
deep structure.
In ABAP, you can define table types using an existing dictionary type. Database
tables, structure definitions, views, data elements, direct type definitions, or
existing table types can be used as line type.
Internally, the system creates a two-dimensional array in the main memory for
each internal table.
A deep structure contains at least one field with a table type. The component of
this table has its own name with which it can be addressed in the same way as
a normal internal table (LOOP AT..., INSERT... INTO TABLE, ...).
An internal table, in turn, can have a deep structure as a line type. In this way,
you can create multidimensional data types, since internal tables and structures
can be inter-nested several times.
Database tables can only include flat structures.
Type groups can be used to define your own global, complex data types and
global constants.
Since Release 4.5a type groups are obsolete and usage of type groups is not
recommended anymore. Instead of using type groups, you can use the options
provided by Dictionary structures to define your own global, complex data types.
Also, you can use constant class-attributes provided by ABAP Objects to define
global constants.
The name of the type group can 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 onward, 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 ABAP Dictionary (SE11) or in the ABAP Editor (SE38).

Anda mungkin juga menyukai