SAP VALUE CONSTRUCTOR PARAMS STRUC SAP Info
ARTICLE ( Version: 0010)
Syntax
Effect
If
like this, the individual components can be specified as named arguments
If a component is itself structured, either a suitable data object can
be assigned to the entire substructure or its components can be specified using the structure component selector (
Any components not specified are ignored and retain their type-specified
initial value. It is not possible to assign multiple values to a component, regardless of how the components are addressed.
Note
If a component with a complex data type is constructed in an argument
position, the value operator
Example
Three different ways of filling a nested structure
values. The structure is given the same values each time. TYPES: BEGIN OF t_col2,
col1 TYPE i,
col2 TYPE i,
END OF t_col2.
TYPES: BEGIN OF t_struct,
col1 TYPE i,
col2 TYPE t_col2,
END OF t_struct.
DATA: struct TYPE t_struct,
col2 TYPE t_col2.
struct = VALUE t_struct( col1 = 1
col2-col1 = 1
col2-col2 = 2 ).
col2 = VALUE t_col2( col1 = 1
col2 = 2 ).
struct = VALUE t_struct( col1 = 1
col2 = col2 ).
struct = VALUE t_struct( col1 = 1
col2 = VALUE #( col1 = 1
col2 = 2 ) ).
Example
See also the example for
>>.
ARTICLE ( Version: 0027)
Syntax
Effect
If
like this, the individual components can be specified as named arguments
If a component is itself structured, either a suitable data object can
be assigned to the entire substructure or its components can be specified using the structure component selector (
Any components not specified are ignored and retain their type-specified
initial value. It is not possible to assign multiple values to a component, regardless of how the component is addressed.
If the
this is initialized first and the assignments in the parentheses are executed directly (from left to right) with the structure components as target fields
Notes
The assignments can be specified in any order within the parentheses.
If a component with a complex data type is constructed in an argument position, the value operator
The rule that a target structure of an assignment is initialized and then edited directly can produce unexpected results if structure components on the left side are specified as data objects pending assignment on the right side. Instead of the right side being evaluated and assigned first, the current value is used in every assignment.
Example
Three different ways of filling a nested structure
values. The structure is given the same values each time. TYPES: BEGIN OF t_col2,
col1 TYPE i,
col2 TYPE i,
END OF t_col2.
TYPES: BEGIN OF t_struct,
col1 TYPE i,
col2 TYPE t_col2,
END OF t_struct.
DATA: struct TYPE t_struct,
col2 TYPE t_col2.
struct = VALUE t_struct( col1 = 1
col2-col1 = 1
col2-col2 = 2 ).
col2 = VALUE t_col2( col1 = 1
col2 = 2 ).
struct = VALUE t_struct( col1 = 1
col2 = col2 ).
struct = VALUE t_struct( col1 = 1
col2 = VALUE #( col1 = 1
col2 = 2 ) ).
Example of a target structure are used as assignment sources. After the assignment,
BEGIN OF struct,
col1 TYPE i VALUE 1,
col2 TYPE i VALUE 2,
col3 TYPE i VALUE 3,
col4 TYPE i VALUE 4,
END OF struct.
struct = value #( col1 = struct-col2
col2 = struct-col1
col4 = 5
col3 = struct-col4 ).
Example
See also the example for
>>.
Message text extract from SAP system. Copyright SAP SE.
Search for further information about these or an SAP related objects