TYPES: BEGIN OF ty_mara,
matnr TYPE matnr,
mtart TYPE mtart,
END OF ty_mara.
DATA: s_mara TYPE ty_mara,
dref TYPE REF TO ty_mara. '' Fully typed
dref1 TYPE REF TO DATA. '' Generic typed
CREATE DATA dref.
GET REFERENCE OF s_mara INTO dref1.
TRY.
dref ?= dref1. '' Down cast
CATCH cx_sy_move_cast_error.
ENDTRY.