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的更多相关文章

  1. ABAP术语-Update Module

    Update Module 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114178.html Part of an update ...

  2. abap开发中update module 的创建和使用

    一.update module 的创建和使用 最近遇到这样一个需求,需要先删除(delete)表中的数据,再将传递过来的新数据添加(modify)到表中. 但是如果下面modify的时候出现错误,使用 ...

  3. update module (更新模块)

    [转自http://blog.csdn.net/zhongguomao/article/details/6712568] function module:更新程序必须用一个特殊的FM(update m ...

  4. ABAP术语-V2 Module

    V2 Module 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/21/1115720.html Analogously to V1 the ...

  5. ABAP术语-V1 Module

    V1 Module 原文;http://www.cnblogs.com/qiangsheng/archive/2008/03/21/1115707.html Function module creat ...

  6. ABAP术语-Update Task

    Update Task 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114184.html Part of an ABAP pro ...

  7. ABAP术语-Function Module

    Function Module 原文:http://www.cnblogs.com/qiangsheng/archive/2008/02/18/1071827.html General-purpose ...

  8. ABAP术语-Update Data

    Update Data 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114169.html The data which is t ...

  9. ABAP术语-Update Key

    Update Key 原文:http://www.cnblogs.com/qiangsheng/archive/2008/03/20/1114171.html Unique character str ...

随机推荐

  1. Hadoop学习之pig

    首先明确pig是解决什么问题而出现的,pig是为了简化mapreduce编程而设计的,并且有自己的一套脚本语言.其基本由命令和操作符来定义的,如load,store,它的功能很明确,用来大规模处理数据 ...

  2. zgrep用法

    http://manpages.ubuntu.com/manpages/trusty/man1/zgrep.1.html NAME Zgrep - search compressed files fo ...

  3. ABP之事件总线(5)

    前面已经对Castle Windsor的基本使用进行了学习,有了这个基础,接下来我们将把我们的事件总线再次向ABP中定义的事件总线靠近.从源码中可以知道在ABP中定义了Dictionary,存放三种类 ...

  4. Docker Compose一键部署Nginx反向代理Tomcat集群

    目录结构如下 mysql/conf/my.cnf [mysqld] user=mysql port=3306 datadir=/var/lib/mysql socket=/var/lib/mysql/ ...

  5. myspl数据库基础

      mysql数据库sql 语句大全收录---sql语句不区分大小写 启动/停止 net start   mysql net stop   mysql 用户登录 mysql -uroot -p    ...

  6. com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'id' at row 1

    1.存储的值超过了字段长度.调整数据库中的字段长度 2,变更字段字符集编码为utf8

  7. 对Entity Framework Core的一次误会:实体状态不跟踪

    在 Entity Framework 中,当通过 EF 使用 LINQ 查询获取到一个实体(实际得到的是 EF 动态生成的实体类的代理类的实例)时,这个实体的状态默认是被跟踪的.所以,当你修改实体的某 ...

  8. [No000015D]【李笑来 笔记整理】个人商业模式升级

    提前知道地图对你到达目标是至关重要的. 比较女性与男性的成本:女性的成本更高(周期性激素分泌波动),所以不要再这个时候和女朋友较劲,她也是身不由己,当你知道这件事情之后,你就会试着去理解她. 下面这张 ...

  9. [No0000128]SQL纵表与横表互转

    1.纵表转横表: 纵表结构:Table1 转换后的横表结构: Sql示例代码: select username, sum(case Course when '语文' then Grade else 0 ...

  10. lua--openresty--

    lua-openresty---docker-- https://blog.csdn.net/boling_cavalry/article/details/79290944 lua-practice ...