To reset a variable var to the appropriate initial value for its type, use the statement
This statement has different effects for different data types:
· Elementary ABAP types
The CLEAR statement sets the value of elementary variables to their initial value (see the keyword documentation) not to the start value, which is set using the VALUE parameter of the DATA statement.
The CLEAR statement resets a reference variable to its initial value, that is, so that it does not point to an object.
The CLEAR statement resets the individual components of a structure to their respective initial values.
· Internal tables
The CLEAR statement deletes the entire contents of an internal table (see also Initializing Internal Tables).
You cannot use the CLEAR statement to reset a constant.
DATA number TYPE i VALUE '10'.
WRITE / number.
The output appears as follows:
The CLEAR statement resets the contents of the field number from 10 to its initial value 0.