BAL_S_LOG - Application Log: Log header data   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.
SAP E-Book

DATA, data_options

Short Reference

... $[ VALUE val$|${IS INITIAL$} $]
    $[ READ-ONLY $].


1. ... VALUE val$|${IS INITIAL$}

2. ... READ-ONLY


The additions VALUE and READ-ONLY are specifically for data objects and distinguish the DATA syntax from the TYPES syntax.


As well as the additions VALUE and READ-ONLY, the syntax also allows the obsolete addition COMMON PART.

Addition 1

... VALUE val$|${IS INITIAL$}


The addition VALUE can be used to define a start value val for the content of a variable for all forms of the variable declaration. This value is used to initialize the variable when it is created before LOAD-OF-PROGRAM. The addition VALUE is not allowed in the declaration part of an interface for the statement DATA.

The start value val can either be specified as a literal or as a predefined constant. Constants, rather than using the actual value, work like the literal that is specified after VALUE when it is declared. A check is usually only performed to check whether the length of the specified value matches the data type and that a syntax check warning occurs if there are any derivations. Only for time stamp type utclong does a character literal that contains a valid representation of a time stamp need to be specified. If the data type of the literal does not match the data type of the declaration, it is usually converted in accordance with the conversion rules for elementary data types during program generation when the program is activated. If the literal cannot be converted to the data type, no syntax error occurs and exception is raised when the program is generated instead.

Without the addition VALUE, or if IS INITIAL is specified, the content is initial. The initial values depend on the data type.

The initial values of elementary types are dependent on the built-in ABAP types. In the case of initial structures, the components are initial, initial reference variables contain the null reference, which does not point to an object, and initial internal tables do not contain any lines.

The addition VALUE is possible for all data types, particularly for the deep types (strings, reference types, table types, or structured types with deep components, including boxed components). A start value val, however, can only be specified for the ABAP types string and xstring. Otherwise, only IS INITIAL is possible. IS INITIAL is also the only possible start value for structures with non-character-like and flat components.

Specifying Type-Friendly Start Values


  • A start value should be specified according to type. In particular, no values that are longer can be specified and, in the case of certain data types such as d and t, the length must match exactly.
  • If numbers with decimal places are specified or specified as a start value for data objects of the data types p or f in scientific notation with mantissa and exponents, it should be ensured that there are no literals for these numbers. Instead, the character literals must be specified with the appropriate content. These are then converted into the numeric data type in accordance with the conversion rules for elementary data types. The same applies to byte-like data objects.
  • If the data object is character-like, the enumerated constants val1, val2, ... of the value set of an enumerated type enum can also be specified for val. The constant then is given the name of the enumerated constant as its value.
  • The value operator VALUE can also be used to construct the content of complex data objects (structures, internal tables).

Declaration of data by specifying the initial value, where one value is specified by a constant.


The following example demonstrates that if a constant is used after VALUE, the literal that is specified after the VALUE addition is evaluated. The variable text1 is given the full content of the literal while the variable text2 is assigned the value of the constant that contains only the digits of the literal and any leading zeros in accordance with the conversion rule from c to n.

Addition 2



This addition is always possible in the public visibility section class or in an interface. This addition ensures that an attribute declared using DATA can be read from outside of the class but can only be changed using methods of the class or its subclasses. This addition has no effect on the friends of the class.

A class attribute defined using READ-ONLY can be used outside of the class, its friends, and subclasses only in reading positions in ABAP statements.


  • The declaration of attributes using the addition READ-ONLY does not prevent methods of the class from passing references to these attributes externally as reference variables or field symbols and therefore making the attributes modifiable outside of the class.
  • The addition READ-ONLY is always recommended if attributes need to be invisible, but a GET method is not executed for every read for performance reasons.

Use of the static constructor as the factory method of a class with instances created privately. The reference to the created singleton objects is available in the READ-ONLY attribute clsref.

PERFORM Short Reference   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.

Length: 8880 Date: 20240614 Time: 041113     sap01-206 ( 150 ms )