SAP ABAP Exception handleing异常处理及使用
来源:互联网 发布:淘宝最新版下载 编辑:程序博客网 时间:2024/05/17 11:34
1、捕获异常
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( ).
cleanup.
clear RESULT.
endtry.
2、抛出异常
report DEMO_RAISE_EXCEPTIONS line-size 100.
data OREF type ref to CX_ROOT.
data TEXT type STRING.
try.
try.
raise exception type CX_DEMO_CONSTRUCTOR
exporting MY_TEXT = SY-REPID.
catch CX_DEMO_CONSTRUCTOR into OREF.
TEXT = OREF->GET_TEXT( ).
write / TEXT.
raise exception OREF.
endtry.
catch CX_DEMO_CONSTRUCTOR into OREF.
TEXT = OREF->GET_TEXT( ).
write / TEXT.
endtry.
3、声明方法抛出的异常
class A_CLASS definition.
public section.
methods FOO importing P type STRING
raising CX_DEMO_CONSTRUCTOR CX_DEMO_ABS_TOO_LARGE.
endclass.
4、定义异常类
class CX_LOCAL_EXCEPTION definition
inheriting from CX_STATIC_CHECK.
endclass.
start-of-selection.
try.
raise exception type CX_LOCAL_EXCEPTION.
catch CX_LOCAL_EXCEPTION.
message 'Local Exception!' type 'I'.
endtry.
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( ).
cleanup.
clear RESULT.
endtry.
2、抛出异常
report DEMO_RAISE_EXCEPTIONS line-size 100.
data OREF type ref to CX_ROOT.
data TEXT type STRING.
try.
try.
raise exception type CX_DEMO_CONSTRUCTOR
exporting MY_TEXT = SY-REPID.
catch CX_DEMO_CONSTRUCTOR into OREF.
TEXT = OREF->GET_TEXT( ).
write / TEXT.
raise exception OREF.
endtry.
catch CX_DEMO_CONSTRUCTOR into OREF.
TEXT = OREF->GET_TEXT( ).
write / TEXT.
endtry.
3、声明方法抛出的异常
class A_CLASS definition.
public section.
methods FOO importing P type STRING
raising CX_DEMO_CONSTRUCTOR CX_DEMO_ABS_TOO_LARGE.
endclass.
4、定义异常类
class CX_LOCAL_EXCEPTION definition
inheriting from CX_STATIC_CHECK.
endclass.
start-of-selection.
try.
raise exception type CX_LOCAL_EXCEPTION.
catch CX_LOCAL_EXCEPTION.
message 'Local Exception!' type 'I'.
endtry.
- SAP ABAP Exception handleing异常处理及使用
- SAP ABAP Exception handleing异常处理及使用
- PHP的异常处理类Exception的使用及说明
- 正确使用Exception异常处理
- sap abap 字符串处理
- Sap abap 字符串处理
- sap abap 日期处理总结
- 使用@ControllerAdvice及@ExceptionHandler(value = Exception.class)全局异常处理
- ABAP异常处理
- ABAP异常处理
- PHP-异常处理Exception,及错误日志处理
- Exception(异常处理)
- Exception异常处理
- Oracle Exception 异常处理
- java异常处理Exception
- Java异常处理Exception
- python Exception 异常处理
- 【java】 异常处理 exception
- Thinstall.VS Package Editor ( 01/30/2008 ) by gyfhgyfh
- SAP ABAP中宏使用
- SAP ABAP中动态方法调用
- Rocket Science & Battle Hymn of the Republic
- 驱动中如何访问CPU中的寄存器?
- SAP ABAP Exception handleing异常处理及使用
- 只需要30秒就可以做的30件事情:你会选择哪一件来改变世界?
- ABAP OO的八大理由(十一)
- 解析C语言中的sizeof
- 2007年美国20大高增长互联网资产
- 最近看过的几本给我印象深刻的书
- My understanding of Enum(enumerate)
- 更深入一点理解 switch 语句 及 c/c++ 对 const 的处理
- 作.Net的一般基础不太好,看看下面几篇文章补补吧