GUIDELINE 6.10
Start Values
ABAP_BACKGROUND
If you declare a data object with the DATA statement, you can use
the VALUE addition to set a value, with which the data object is
filled when it is created. If the VALUE addition is not used, the
system uses the type-specific initial value. If the CONSTANTS
statement is used, the VALUE addition must always be specified.
If the type-compliant initial value is required here, this can be
achieved using the addition VALUE IS INITIAL .
If the specified start value does match the type and length of the data
object, the value is converted when the program is generated.
ABAP_RULE
Start values must match the data type of the data object
Only use the addition VALUE to enter start values that exactly
match the data type of the declared data object in terms of type,
content, and length.
ABAP_DETAILS
The start value cannot always be specified to conform with the type,
since ABAP does not support type-compliant
literals for all possible data types. In all cases where a conversion
cannot be avoided, choose the content of literals specified as start v
alues so that the actual value meets the requirements when the source
code is read.
Bad example
The average reader may well expect the constant high_noon in the
following source code to contain the value 120000. However, the constant
actually contains the value 092000, because the value of the numerical
literal refers to the number of seconds. This means 12,000 seconds is
actually the time 09:20 on the following day.
CONSTANTS high_noon TYPE t VALUE 120000.
Good example
The following source code corrects the above example by replacing the
number literal with a text field literal. Now the constant
high_noon
contains the expected value 120000.
CONSTANTS high_noon TYPE t VALUE '120000'.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved