abap异常处理 , update module
1:异常
https://www.cnblogs.com/rainysblog/p/6665455.html
2:update module
https://www.cnblogs.com/cindyLu/p/3645423.html
https://wenku.baidu.com/view/81ce505d0508763230121209.html
3:程序:
REPORT demo_catch_exception.
DATA(in) = cl_demo_input=>new( ).
DATA: resumable TYPE abap_bool VALUE abap_false,
before_unwind TYPE abap_bool VALUE abap_false,
resume TYPE abap_bool VALUE abap_false.
in->add_field( EXPORTING as_checkbox = 'X'
text = 'RAISE RESUMABLE'
CHANGING field = resumable
)->add_field( EXPORTING as_checkbox = 'X'
text = 'CATCH BEFORE UNWIND'
CHANGING field = before_unwind
)->add_field( EXPORTING as_checkbox = 'X'
text = 'RESUME'
CHANGING field = resume
)->request( ).
CLASS lcx_exception DEFINITION INHERITING FROM cx_static_check.
ENDCLASS.
CLASS exc_demo DEFINITION.
PUBLIC SECTION.
CLASS-DATA out TYPE REF TO if_demo_output.
CLASS-METHODS: main,
meth1 RAISING lcx_exception,
meth2 RAISING RESUMABLE(lcx_exception).
ENDCLASS.
FIELD-SYMBOLS <fs> TYPE any.
CLASS exc_demo IMPLEMENTATION.
METHOD main.
out = cl_demo_output=>new( ).
DATA exc TYPE REF TO lcx_exception.
IF before_unwind = abap_false.
TRY.
out->write( 'Trying method call' ).
IF resumable = abap_false.
exc_demo=>meth1( ).
ELSEIF resumable = abap_true.
exc_demo=>meth2( ).
ENDIF.
CATCH lcx_exception.
IF <fs> IS ASSIGNED.
out->write( 'Context of method available' ).
ELSE.
out->write( 'Context of method not available' ).
ENDIF.
ENDTRY.
out->write( 'Continue after main TRY block' ).
ELSEIF before_unwind = abap_true.
TRY.
out->write( 'Trying method call' ).
IF resumable = abap_false.
exc_demo=>meth1( ).
ELSEIF resumable = abap_true.
exc_demo=>meth2( ).
ENDIF.
CATCH BEFORE UNWIND lcx_exception INTO exc.
IF <fs> IS ASSIGNED.
out->write( 'Context of method available' ).
ELSE.
out->write( 'Context of method not available' ).
ENDIF.
IF resume = abap_true.
IF exc->is_resumable = abap_true.
RESUME.
ELSE.
out->write( 'Resumption not possible' ).
ENDIF.
ENDIF.
ENDTRY.
out->write( 'Continue after main TRY block' ).
ENDIF.
out->display( ).
ENDMETHOD.
METHOD meth1.
DATA loc TYPE i.
ASSIGN loc TO <fs>.
TRY.
out->write( 'Raising non-resumable exception' ).
RAISE EXCEPTION TYPE lcx_exception.
out->write( 'Never executed' ).
CLEANUP.
out->write( 'Cleanup in method' ).
ENDTRY.
out->write( 'Continue after TRY block in method' ).
ENDMETHOD.
METHOD meth2.
DATA loc TYPE i.
ASSIGN loc TO <fs>.
TRY.
out->write( 'Raising resumable exception' ).
RAISE RESUMABLE EXCEPTION TYPE lcx_exception.
out->write( 'Resuming method' ).
CLEANUP.
out->write( 'Cleanup in method' ).
ENDTRY.
out->write( 'Continue after TRY block in method' ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
exc_demo=>main( ).
abap异常处理 , update module的更多相关文章
- ABAP术语-Update Module
Update Module 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114178.html Part of an update ...
- abap开发中update module 的创建和使用
一.update module 的创建和使用 最近遇到这样一个需求,需要先删除(delete)表中的数据,再将传递过来的新数据添加(modify)到表中. 但是如果下面modify的时候出现错误,使用 ...
- update module (更新模块)
[转自http://blog.csdn.net/zhongguomao/article/details/6712568] function module:更新程序必须用一个特殊的FM(update m ...
- ABAP术语-V2 Module
V2 Module 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/21/1115720.html Analogously to V1 the ...
- ABAP术语-V1 Module
V1 Module 原文;http://www.cnblogs.com/qiangsheng/archive/2008/03/21/1115707.html Function module creat ...
- ABAP术语-Update Task
Update Task 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114184.html Part of an ABAP pro ...
- ABAP术语-Function Module
Function Module 原文:http://www.cnblogs.com/qiangsheng/archive/2008/02/18/1071827.html General-purpose ...
- ABAP术语-Update Data
Update Data 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114169.html The data which is t ...
- ABAP术语-Update Key
Update Key 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114171.html Unique character str ...
随机推荐
- LostRoutes项目日志——敌人精灵Enemy解析
Enemy类在Enemy.js中,类Enemy类继承自PhysicsSprite,以便于可以使用物理引擎中的一些特性. 原版的Enemy.js: var Enemy = cc.PhysicsSprit ...
- 【转载】eclipse常用插件在线安装地址或下载地址
一,反编译插件: A.Jadclipse 1.打开eclipse增加站点:http://jadclipse.sf.net/update,在线安装好JDT Decompiler 3.4.0 2.http ...
- linux 几个命令
tail: tail -20 xxx --查看xxx文件的最后20行 more:分页查看,只能向后,不能向前 less:查看文件,可向前,向后,用的比较多 ll -h|more:当文件较多时,可以通 ...
- LeetCode - 386. Lexicographical Numbers
Given an integer n, return 1 - n in lexicographical order. For example, given 13, return: [1,10,11,1 ...
- POJ 1958 Strange Towers of Hanoi
Strange Towers of Hanoi Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3784 Accepted: 23 ...
- TIScript Graphics
$(#main_frame).paintContent = function(gfx) { gfx.pushLayer(#background-area); gfx.translate(0.5,0.5 ...
- Sequential Minimal Optimization (SMO) 算法
SVM 最终关于 $a$ 目标函数为凸优化问题,该问题具有全局最优解,许多最优化算法都可以解决该问题,但当样本容量相对很大时,通常采用 SMO 算法(比如 LIBSVM),该算法为启发式算法,考虑在约 ...
- callback 模式
回调,是一种机制,同时也是一种设计模式. 我们定义一个函数,让能够回调 import _products from './products.json' const TIMEOUT = 100 cons ...
- python3.6利用pyinstaller模块打包程序为.exe可执行程序
步骤: 1.安装pyinstaller模块:(必须在联网情况下进行) 操作原理: python3.6已经自带了pip,所以只需要在cmd中执行 pip install pyinstaller 就可以安 ...
- CentOS安装中文支持包
修改配置文件 LANG="zh_CN.UTF-8" 改为中文字符集 然后在查看更改后的系统语言变量 [root@5c46832b5c01 ~]# locale locale: Ca ...