abapOpenChecks
abapOpenChecks copied to clipboard
Read Table: if read into variable, check variable type
Example:
Structure read into regular variable, will probably cause false results. Compiler allows this:
" TYPES: BEGIN OF ty_buffer
" input TYPE erdat,
" output TYPE syst_datum,
" END OF ty_buffer.
" DATA buffer_foo TYPE TABLE OF ty_buffer.
DATA r_date TYPE syst_datum.
r_date = VALUE #( buffer_foo[ input = i_input ] OPTIONAL ).
" correct would be:
" r_date = VALUE #( buffer_foo[ input = i_input ]-output OPTIONAL ).
Same with Read Table:
READ TABLE buffer_foo INTO r_date WITH KEY input = i_input.