SAP NEW CONSTRUCTOR PARAMS SINGLE



Get Example source ABAP code based on a different SAP table
  



NEW, Single Value for All Data Types

ABAP_SYNTAX
... NEW dtype$|#( $[let_exp$] dobj ) ...

What does it do?
If dtype is a non-generic elementary data type, a structured type, a table type, or a reference type or # is used for a type like this, a single data object dobj can be specified as a unnamed argument that is convertible to or from data type dtype . dobj is a general expression position. The value of dobj is assigned to the created anonymous data object. The assignment is made in accordance with the applicable assignment rules. Optionally, a LET expression let_exp can be specified in front of the data object to define local helper fields.



Latest notes:

In particular, an expression specified for dobj can be a constructor expression itself or contain a constructor expression.
When a constructor expression is assigned to a reference variable using NEW, the original reference is available in the entire expression in the target variable. The target variable is not overwritten until the expression is completed.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
Construction of an anonymous data object of the type string, whose value is determined using a string expression.
ABEXA 01168
ABAP_EXAMPLE_END

ABAP_EXAMPLE_VX5
For each line read, a structured anonymous data object is created in a SELECT loop, to which the content of the line is assigned. The object is created in the general expression position of the statement APPEND and the created data reference is appended directly to an internal table with the appropriate line type. The result is a table that references all new anonymous data objects.
ABEXA 01169
ABAP_EXAMPLE_END