ABAP Keyword Documentation → ABAP − Reference → Creating Objects and Values → NEW - Instance Operator
NEW - Initial Value for All Types
Other versions:
7.31 | 7.40 | 7.54
Syntax
... NEW dtype|class|#( ) ...
Effect
If no parameters are specified,
- an anonymous data object retains its type-specific initial value,
- no values are passed to the instance constructor of an object.
This is possible for every non-generic data type dtype
. The instance constructor
of a class class
can either have only optional input parameters or no input parameters at all. The #
symbol can stand for appropriate types.
Note
If dtype
or #
stand for an
enumerated type, its initial value is generated according to its
base type.
Example
After the following program section is executed, dref
points to an empty internal table with the row type T100. Both constructor expressions have the same function.
TYPES t_itab TYPE TABLE OF t100 WITH EMPTY KEY.
DATA dref TYPE REF TO t_itab.
dref = NEW #( ).
dref = NEW t_itab( ).