Reference variables contain references. The actual contents of a reference variable, namely the value of a reference, is not visible in an ABAP program. ABAP contains data references and object references. Consequently, there are two kinds of data reference variables - data reference variables and object reference variables.
You create the data type of a data reference variable using:
TYPES t_dref TYPE REF TO DATA.
You can create a data reference variable either by referring to the above data type or using:
DATA dref TYPE REF TO DATA.
Reference variables are handled in ABAP like other data objects with an elementary data type. This means that a reference variable can be defined as a component of a complex data object such as a structure or internal table as well as a single field.
Reference variables are initial when you declare them. They do not point to an object. You cannot dereference an initial reference variable. A data reference variable can point to a data object if you
· Use it to create a data object dynamically.
· Use it to get a reference to a data object.
· Assign an existing data reference to it from another data reference variable.
You can assign references between data reference variables using the MOVE statement or the assignment operator (=), and also when you fill an internal table or pass interface parameters to a procedure. If you assign references in this way, the operands must be typed as data reference variables. You cannot assign to object reference variables or other variables. After the assignment, the reference in the target variable points to the same data object as the reference in the source variable.