ABAP预定义的异常类在某些时候并不能精确地描述异常,此时就需要自定义异常类。
1、自定义异常类
1、定义消息类
2、自定义异常类
在Local Types中自定义异常类,当异常触发时,提示airline和connection不存在。
CLASS lcx_no_connection DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES if_t100_message.
METHODS constructor
IMPORTING
textid LIKE if_t100_message=>t100key OPTIONAL
previous LIKE previous OPTIONAL
airlineid TYPE /dmo/carrier_id OPTIONAL
connectionnumber TYPE /dmo/connection_id OPTIONAL.
CONSTANTS:
BEGIN OF lcx_no_connection,
msgid TYPE symsgid VALUE