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 ...
随机推荐
- Go语言学习笔记1
1.Go语言环境搭建及基础知识 Go语言官方网站(http://golang.org) 代码包文档网站(http://godoc.org) Go语言中文网(http://studygolang.com ...
- vmware的centos 6虚拟机如何共享文件夹?
1.点 虚拟机-设置 2. 点击 选项-共享文件夹: 3.点击添加,选择 windows主机的一个文件夹作为 共享文件夹: 5.点击完成-确定以后,重启虚拟机(客户机),在虚拟机中: 点击 compu ...
- 36个让人惊讶的 CSS3 动画效果演示【转】
本文收集了35个惊人的 CSS3 动画演示,它们将证明 CSS3 Transform 和 Transition 属性的强大能力.CSS 是网页设计非常重要的一部分,随着越来越多的浏览器对 CSS3 支 ...
- linux升级内核
- jenkins管理
1.1 重启,重载,关闭 http://10.0.0.51:8080/jenkins/restart 重启 http://10.0.0.51:8080/jenkins/reload ...
- DSO论文解读
dso 1.1. Motivation 本文提出的单目视觉测距法的直接和稀疏公式是出于以下考虑因素; (1)直接: 关键点的主要优点之一是它们能够为使用现成的商品相机拍摄的图像中存在的光度和几何失真提 ...
- 深度学习模型融合stacking
当你的深度学习模型变得很多时,选一个确定的模型也是一个头痛的问题.或者你可以把他们都用起来,就进行模型融合.我主要使用stacking和blend方法.先把代码贴出来,大家可以看一下. import ...
- CSS 小技巧
CSS 小技巧 一.边框内圆角 我们在设计例如按钮等控件的时候,会遇到这样的设计:只有内侧有圆角,而边框或者描边的四个角还是保持直角的形状,用以下代码可以轻松的实现. #wrapper { width ...
- 一道与时间差有关的SQL面试题
题目: 一组通话记录(总共500万条):ID 主叫号码 被叫号码 通话起始时间 通话结束时间 通话时长1 98290000 0215466546656 2007-02-01 09:49:53.000 ...
- UILabel中NSAttributedString和其LinebarkModel等属性之间的关系
如果设置了一个富文本给一个UILabel,那么后续改变这个UILabel的属性时将会同时改变UILabel.attributedText的属性描述,此时若改变了其它的大小.换行模式(如果在显示时我们可 ...