SAP NEW CONSTRUCTOR PARAMS INITIAL

Get Example source ABAP code based on a different SAP table
  


ARTICLE

NEW - Initial Value for All Types

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.

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( ).