Here is one for you.
How come that this one does not compile
REPORT ZZY.
TYPES: my_int TYPE x LENGTH 4,
my_int_table TYPE STANDARD TABLE OF my_int WITH EMPTY KEY.
DATA(g_tab_my_int) = VALUE my_int_table( ( 2 ) ).
and this one does?
REPORT ZZY.
TYPES: my_int TYPE x LENGTH 4,
my_int_table TYPE STANDARD TABLE OF my_int WITH EMPTY KEY.
DATA(g_tab_my_int) = VALUE my_int_table( ( 2 * 1 ) ).
The ABAP documentation for inside VALUE dtype|#( line | {LINES OF itab ...} )
says:
If a data object is specified for
line
, this object must be compatible with the row type.If an expression (built-in function, functional method, calculation expression, constructor expression, or table expression) is specified for
line
, the result of the expression must be convertible to the row type.
In your example:
You may enter a shorter expression like "+ 2" : VALUE my_int_table( ( + 2 ) ).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With