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 ...
随机推荐
- xml和json格式输出
<?php class Response{ const JSON ='json'; /* * 按综合方式输出通信数据 * @param integer $ ...
- [LintCode] Max Points on a Line 共线点个数
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...
- Tarjan 强连通分量 及 双联通分量(求割点,割边)
Tarjan 强连通分量 及 双联通分量(求割点,割边) 众所周知,Tarjan的三大算法分别为 (1) 有向图的强联通分量 (2) 无向图的双联通分量(求割点,桥) ...
- cobbler搭建本地的yum仓库源
cobbler自动化安装参考文档 https://www.cnblogs.com/minseo/p/8537266.html 使用cobbler可以快速搭建一个本地的yum仓库 cobbler rep ...
- API(三)之Class-based Views
使用基于类的视图重写API 我们首先将根视图重写为基于类的视图.所有这一切都涉及到重构views.py. from snippets.models import Snippet from snippe ...
- 初探Spring Cloud Config
Spring Cloud Config提供了分布式系统中配置功能的服务端与客户端支持.对于不同环境的应用程序它的服务端提供了一种中心化的配置管理方式.并且其不仅适用于Spring的应用程序,其它语言开 ...
- React 60S倒计时
React 60S倒计时 1.设置状态: 2.函数主体: 3.应用: 4..效果图:
- 应用打开其xlspptdoc等
http://www.libxl.com/documentation.html xls读写编辑类库libxl https://blog.csdn.net/songbob/article/detail ...
- https://pypi.org/project/py-mysql2pgsql/
https://packages.ubuntu.com/trusty/postgresql-server-dev-9.3 所以使用下面的命令即可安装python-dev: yum install py ...
- [daily][mariadb][mysql] mariadb快速设置
参考: https://wiki.archlinux.org/index.php/MySQL 1. 安装 使用pacman常规安装 2. btrfs 禁用CoW mariadb的数据文件如果存储在bt ...