how to use object based exception combined with message class in SE91

82 阅读1分钟

Created by Wang, Jerry, last modified on Dec 20, 2014

创建一个新的ABAP异常类,确保Class Type选择成Exception Class,并勾上With Message Class的勾。

use the following code to raise and catch exception: abap data: lo_own TYPE REF TO ZCX_RTTC_WRAPPER1, lv_text TYPE string, lo_root TYPE REF TO cx_root. CREATE OBJECT lo_own EXPORTING textid = zcx_rttc_wrapper1=>OUT_DEL_NOT_RELEASED. lo_own->ms_out_del_id = 'test1'. TRY. RAISE EXCEPTION lo_own. CATCH cx_root INTO lo_root. lv_text = lo_root->get_text( ). BREAK-POINT. ENDTRY .

要获取更多Jerry的原创文章,请关注公众号"汪子熙":