ABAP Keyword Documentation → ABAP  Reference → Declarative statemnts → Data Types and Data Objects → Declaring Data Types → TYPES
TYPES  TYPE abap_type
Other versions: 7.31  7.40  7.54
Syntax
TYPES { {dtype[(len)] TYPE abap_type [DECIMALS dec]}
 {dtype TYPE abap_type [LENGTH len] [DECIMALS dec]} }.
Effect
If a predefined data
type abap_type
is specified, a nongeneric elementary data type is defined. For abap_type
, you can use all
predefined data types, except the internal types b
and s
.
For the ABAP types c
, n
, p
and x
, the length of the data type dtype
must be specified by entering directly a number or a numeric constant len
within the associated
interval limits. For all other ABAP types,
the length is determined by the value in the table of predefined ABAP types and no length can be specified in len
.
The length len
is either specified in parentheses directly after the type
name dtype
, or after the addition LENGTH
. The specified length must be positive.
If the addition DECIMALS
is used for the ABAP type p
, the number of
decimal places must
be determined. To do this, specify directly a number or a numerical constant dec
within the interval limits from the
table of value areas in predefined numerical types. For the decimal separator to be taken into account in operations involving packed numbers, the
program attribute
fixed point arithmetic must be set. Otherwise, the addition DECIMALS
only affects the output on screens and the format for the statement WRITE [TO]
.
Notes
 You do not need to list all additions in obsolete variants of the above statement. These additions are automatically completed.

For reasons of legibility, your are advised to always use the addition
LENGTH
, and not parentheses, to specify the lengthlen
.
Example
These statements create three elementary data types that are local to the program. Values for the unspecified
technical properties of the predefined types c
and p
are specified.
TYPES: text10 TYPE c LENGTH 10,
text20 TYPE c LENGTH 20,
result TYPE p LENGTH 8 DECIMALS 2.