I've seen several ABAP standard methods that return a reference to data as result.
CL_ABAP_EXCEPTIONAL_VALUES=>GET_MAX_VALUE( )
is one of those methods. My natural inclination is to use this method in a single line, like this:
DATA lv_max_value TYPE i.
lv_max_value = CL_ABAP_EXCEPTIONAL_VALUES=>GET_MAX_VALUE( lv_max_value )->*.
Sadly, this doesn't work, because:
Result type of the functional method "GET_MAX_VALUE" is not an object reference or an interface reference.
The question at hand is: is it possible to dereference such results directly?
Whenever I am certain that results are compatible I would prefer to avoid the old method of dereferencing (storing the reference, assigning it to a field-symbol and then putting it into destination variable) :
DATA lv_max_value TYPE i.
DATA ref TYPE REF TO data.
FIELD-SYMBOLS <field> TYPE any.
ref = CL_ABAP_EXCEPTIONAL_VALUES=>GET_MAX_VALUE( lv_max_value ).
ASSIGN ref->* TO <field>.
lv_max_value = <field>.
It seems like a massive operation for a simple action.