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. 【问题集】redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range

    redis.clients.jedis.exceptions.JedisDataException: ERR value is not an integer or out of range incrm ...

  2. Don't forget to Cherish

    Watch the video Cherish time, Cherish memories, Cherish tears, Cherish smiles, Cherish friends, Cher ...

  3. 【黑金原创教程】【FPGA那些事儿-驱动篇I 】实验四:按键模块③ — 单击与双击

    实验四:按键模块③ - 单击与双击 实验三我们创建了"点击"还有"长点击"等有效按键的多功能按键模块.在此,实验四同样也是创建多功能按键模块,不过却有不同的有效 ...

  4. 混合模式为什么成为占有率最高的app开发技术

    在企业移动战略布局中,app已成为连接业务与用户最主要的载体,同样其开发技术目前也处于十分成熟的阶段,而从技术实现的角度去考量,很多从业者可能并不知道,越是大企业.越是IT预算多的企业,他们的移动ap ...

  5. python实现支持目录FTP上传下载文件的方法

    #!/usr/bin/env python # -*- coding: utf-8 -*- import ftplib import os import sys class FTPSync(objec ...

  6. ArcEngine二次开发,TOCControl控件上使用contextMenuStrip

    右键菜单,在二次开发中很实用,以前没用过,最近通过一本书了解到,一直想找这么一个控件来用. 一般的控件,将contextMenuStrip控件拖到所依托的控件上,然后输入自己想要的几个功能.  在所依 ...

  7. [development][c++] C++构造函数调用构造函数

    构造函数调用构造函数是会问题的. 外层函数返回的内存, 与被调用的构造函数返回的内存并不是一个内存. 错误示例代码如下: msg_log(const char *name, const char* t ...

  8. iOS-Core-Animation-Advanced-Techniques/13-高效绘图 【没理解】

    #import "DrawingView.h" #import <QuartzCore/QuartzCore.h> @interface DrawingView () ...

  9. Js_protoType_原型

    1.什么是原型? 之前在网上看了好多,各种说法的都有,说的很晦涩,很难理解,我觉得用的多了就会慢慢理解它的意思,总之来说,每个对象都有一个指向它原型,也就是每个对象都有原型. 2.原型有什么用? 原型 ...

  10. 【Python全栈-CSS】CSS入门

    CSS入门教程 参考: http://www.cnblogs.com/yuanchenqi/articles/5977825.html http://www.ruanyifeng.com/blog/2 ...