data: begin of ttt occurs 0, mm type mara-matnr, end of ttt. ttt-mm = 'DISPO'.append ttt. ttt-mm = 'PLIFZ'.append ttt.types: s_ttt like line of ttt.FIELD-SYMBOLS: A TYPE s_ttt.FIELD-SYMBOLS: B TYPE c.DATA: lcx_error TYPE REF TO cx_root, err
data: begin of ttt occurs 0,
mm type mara-matnr,
end of ttt.
ttt-mm = 'DISPO'.
append ttt.
ttt-mm = 'PLIFZ'.
append ttt.
types: s_ttt like line of ttt.
FIELD-SYMBOLS: <A> TYPE s_ttt.
FIELD-SYMBOLS: <B> TYPE c.
DATA: lcx_error TYPE REF TO cx_root,
err_text TYPE c LENGTH 1000.
loop at ttt assigning <a>.
try.
ASSIGN (<A>-mm) TO <B>.
if <b> is assigned.
WRITE <B>.
unassign <b>.
else.
write 'error'.
endif.
catch CX_SY_ASSIGN_CAST_ILLEGAL_CAST into lcx_error.
err_text = lcx_error->get_text( ). "得到错误信息
write err_text.
endtry.
endloop.