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 ...
随机推荐
- No suitable servers found (`serverselectiontryonce` set): [Failed connecting to '115.28.161.44:27017': Connection timed out] php mongodb 异常
我 php mongodb 拓展使用的是 MongoDB driver 今天查询数据的时候 偶尔会提示, No suitable servers found (`serverselectiontry ...
- [转]sudo找不到命令:修改sudo的PATH路径
sudo有时候会出现找不到命令,而明明PATH路径下包含该命令,让人疑惑.其实出现这种情况的原因,主要是因为当 sudo以管理权限执行命令的时候,linux将PATH环境变量进行了重置,当然这主要是因 ...
- day_6.10py面试题:访问百度的过程
DNS : 解析域名 DHCP:一种协议,自动分配ip 发现局域网中没有ip的电脑分配ip 面试题: 访问百度的整个过程 打开浏览器,访问百度的过程: 1.我的电脑确定有无网关,arp得到默认网管ma ...
- ASP.NET Core 的Windows和IIS宿主(自动翻译记录)
https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x 支持的操作系统 以下操作系统的支持: Win ...
- MySQL的sql语言分类DML、DQL、DDL、DCL、
MySQL的sql语言分类DML.DQL.DDL.DCL. SQL语言一共分为4大类:数据定义语言DDL,数据操纵语言DML,数据查询语言DQL,数据控制语言DCL 1.数据定义语言DDL(Data ...
- POJ 2259 - Team Queue - [队列的邻接表]
题目链接:http://poj.org/problem?id=2259 Queues and Priority Queues are data structures which are known t ...
- [No0000CF]想有一辈子花不完的钱?从了解“被动收入”开始吧
我想从理清自己所说被动收入的含义,开始创作此被动收入系列文章. 我更喜欢把被动收入较宽泛地定义为,甚至当你没有主动工作时,仍可赚取的收益.被动收入的另一个名称是剩余收入. 相比之下,当你停止工作时,通 ...
- 用CountDownLatch提升请求处理速度
countdownlatch是java多线程包concurrent里的一个常见工具类,通过使用它可以借助线程能力极大提升处理响应速度,且实现方式非常优雅.今天我们用一个实际案例和大家来讲解一下如何使用 ...
- C和C指针小记(七)-整型变量范围
1.变量范围 limits.h 头文件中定义来C 语言的变量范围. 变量范围的限制 //char 的范围 printf("CHAR_BIT:%d CHAR_MIN:%d CHAR_MAX:% ...
- day0320 时间模块 collection模块
一. TIME模块 python提供了一个time和calendar模块可以用于格式化日期和时间. 时间间隔一秒为单位. 每个时间戳都以1970年1月1日午夜经过多长时间来表示. 1.时间戳 函数ti ...