SAP VALUE CONSTRUCTOR PARAMS ITAB
Get Example source ABAP code based on a different SAP table
ARTICLE
Syntax
Effect
If
Note
Internal table rows are constructed in accordance with the rules for the instance operator
Example
Constructs an internal table with an elementary row type and fills it with three rows. The first row inserted is initial. TYPES t_itab TYPE TABLE OF i WITH EMPTY KEY.
DATA itab TYPE t_itab.
itab = VALUE #( ( ) ( 1 ) ( 2 ) ).
Example
Constructs an internal table with an elementary row type of type
DATA date_tab TYPE t_date_tab.
date_tab = VALUE #(
( |{ CONV d( sy-datlo - 1 ) DATE = ENVIRONMENT }| )
( |{ sy-datlo DATE = ENVIRONMENT }| )
( |{ CONV d( sy-datlo + 1 ) DATE = ENVIRONMENT }| ) ).
Example
Constructs an internal table with a structured row type and fills it with two rows. The structures are filled with values component by component. TYPES: BEGIN OF t_struct,
col1 TYPE i,
col2 TYPE i,
END OF t_struct,
t_itab TYPE TABLE OF t_struct WITH EMPTY KEY.
DATA itab TYPE t_itab.
itab = VALUE #( ( col1 = 1 col2 = 2 )
( col1 = 3 col2 = 4 ) ).
Example
Constructs a
itab = VALUE #( sign = 'I' option = 'BT' ( low = 1 high = 10 )
( low = 21 high = 30 )
( low = 41 high = 50 )
option = 'GE' ( low = 61 ) ).
Example
Constructs an internal table with a tabular row type and fills it with two rows. The first row is assigned a table that is already filled. The second row is constructed using
t_itab2 TYPE TABLE OF t_itab1 WITH EMPTY KEY.
DATA itab1 TYPE t_itab1.
DATA itab2 TYPE t_itab2.
itab1 = VALUE #( ( 1 ) ( 2 ) ( 3 ) ).
itab2 = VALUE #( ( itab1 )
( VALUE t_itab1( ( 4 ) ( 5 ) ( 6 ) ) ) ).
Example
See also the examples for the instance operator