abap事件。

Posted liyafei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了abap事件。相关的知识,希望对你有一定的参考价值。

1:https://www.w3cschool.cn/sap_abap/sap_abap_object_events.html

 

*&---------------------------------------------------------------------*
*& Report ZHANSEN28
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zhansen28.
CLASS cl_main DEFINITION.
  PUBLIC SECTION.
    DATA: num1 TYPE i.
    METHODS: pro IMPORTING num2 TYPE i.
    EVENTS: cutoff.
ENDCLASS.

CLASS cl_eventhandler DEFINITION.
  PUBLIC SECTION.
    METHODS: handling_cutoff FOR EVENT cutoff OF cl_main.
ENDCLASS.


CLASS cl_main IMPLEMENTATION.
  METHOD pro.
    num1 = num2.
    IF num2 GE 2.
      RAISE EVENT cutoff.
    ENDIF.
  ENDMETHOD.
ENDCLASS.

CLASS cl_eventhandler IMPLEMENTATION.
  METHOD handling_cutoff.
    WRITE: Handling the CutOff.
    WRITE: / Event has been processed.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  DATA: main1 TYPE REF TO cl_main.
  DATA: eventhandler1 TYPE REF TO cl_eventhandler.

  CREATE OBJECT main1.
  CREATE OBJECT eventhandler1.

  SET HANDLER eventhandler1->handling_cutoff FOR main1.
  main1->pro( 4 ).

 

以上是关于abap事件。的主要内容,如果未能解决你的问题,请参考以下文章

请教一个abap事件AT SELECTION-SCREEN的问题。。

abap事件。

SAP ABAP 编程问题

abap简单报表,alv显示,按钮事件

ABAP SM30视图 自定义搜索帮助

ABAP SM30视图 自定义搜索帮助