A data type or object type type that matches the operator and that can be derived implicitly from the operand position using #
Type-specific parameters specified in parentheses
Each constructor expression creates a result whose data type is determined using the specified type. The parameters specified in parentheses are used to pass input values. The following constructor operators exist:
The instance operator NEW
is used to create objects in operand positions. The result is a reference variable of the static type
type that points to the new object. The input values determine the content of the new object.
The value operator VALUE
is used to fill complex data objects with values in operand positions, create initial values of any data type, or control the results of
table expressions.
The result is a data object of the specified type type. The input values determine the content of the result.
The conversion operator CONV
is used for conversions between data types in operand positions. The result is a data object of the specified type type produced by the conversion from an input value.
The casting operator CAST
is used for down casts of reference variables in operand positions. The result is a reference variable of the static type type produced by the assignment from an input value.
The reference operator REF is used to construct a data reference to a data object in operand positions or to control the results of
table expressions. The result is a
data reference variable.
The component operator CORRESPONDING
is used to construct a structure or an internal table in an operand position. The result is a structure
or internal table whose components are filled with values from identically named components or from argument components specified in a parameter using a mapping rule.
The lossless operator EXACT
is used to create a value in an operand position without losing data. The result is a data object of the specified type, derived from a
lossless assignment or a
lossless calculation.
The reduction operator REDUCE constructs a value from condition iterations or from table iterations.
The filter operator FILTER constructs an internal table by filtering the rows of an internal table.
The conditional operators COND
and SWITCH
are used to create values or raise class-based exceptions in operand positions in accordance with conditions. The result is determined by logical expressions or by a case distinction.
Data types and classes that are visible and usable in the current operand position can be specified for type. This includes the
built-in
ABAP types, types defined using TYPES, types from
ABAP Dictionary, and both local and global classes.
If the data type required in an operand position is unique and fully recognizable, the # character can be used instead of an explicitly specified type type and the
operand type is used.
If the operand type is not unique and is not known completely, a type inference is performed to determine a data type. This is described in each constructor expression.
LET expressions can be used to define local helper fields in all suitable constructor expressions.
Notes
Constructor operators can be classified as follows:
Constructor operators like NEW and VALUE construct
new values whose parts can be passed (except when the initial value is created), whereas constructor
operators like CONV, CAST, REF, and EXACT convert a single passed value.
Constructor operators like NEW, CAST, and
REF always return reference variables, whereas constructor operators like
VALUE, CONV, and EXACT return all types of data objects.