abap异常分类:
1)基于异常类的异常,相当于java中的exception体系
2)非异常类异常,这种异常又分为系统定义异常(相当于java中的error体系)和用户自定义异常(用法同java throw exception)
示例一:处理异常
program:
data: result type p decimals 2, number type i value 0.data oref TYPE REF TO cx_root.data text type string.try. RESULT = 1 / NUMBER.write: / 'Result of division:', RESULT.RESULT = SQRT( NUMBER ).write: / 'Result of square root:', RESULT.catch CX_SY_ZERODIVIDE into OREF. TEXT = OREF->GET_TEXT( ). write text.clear RESULT.endtry.
result:
Division by zero