METHODS : handle_event_raised FOR EVENT event_raised OF lcl_event_raiser.
SET HANDLER me->handle_event_raised FOR i_raiser.
CLASS lcl_event_raiser DEFINITION FINAL.
PUBLIC SECTION.
EVENTS : event_raised.
CLASS-METHODS : start.
PRIVATE SECTION.
CLASS-DATA : m_object TYPE REF TO lcl_event_raiser.
METHODS : raise_event.
ENDCLASS.
CLASS lcl_event_handler DEFINITION FINAL.
PUBLIC SECTION.
METHODS : handle_event_raised FOR EVENT event_raised OF lcl_event_raiser.
METHODS : constructor
IMPORTING
i_raiser TYPE REF TO lcl_event_raiser
i_number TYPE i.
PRIVATE SECTION.
DATA : m_handler TYPE i.
ENDCLASS.
CLASS lcl_event_raiser IMPLEMENTATION.
METHOD start.
CREATE OBJECT m_object.
DO 3 TIMES.
DATA(l_handler) = NEW lcl_event_handler( i_raiser = m_object
i_number = sy-index ).
m_object->raise_event( ).
FREE l_handler.
ENDDO.
m_object->raise_event( ).
ENDMETHOD.
METHOD raise_event.
RAISE EVENT event_raised.
ENDMETHOD.
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION.
METHOD constructor.
SET HANDLER me->handle_event_raised FOR i_raiser.
me->m_handler = i_number.
ENDMETHOD.
METHOD handle_event_raised.
WRITE : / me->m_handler.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
lcl_event_raiser=>start( ).
........
* Definition part
METHODS : free.
PRIVATE SECTION.
DATA : m_raiser TYPE REF TO lcl_event_raiser.
........
........
METHOD constructor.
.......
me->m_raiser = i_raiser.
SET HANDLER me->handle_event_raised FOR me->m_raiser.
.......
ENDMETHOD.
* Implementation Part
METHOD free.
SET HANDLER me->handle_event_raised FOR me->m_raiser ACTIVATION SPACE.
* Other data you want to clear, refresh or free
CLEAR : me->m_handler.
ENDMETHOD.
...........
METHOD start.
CREATE OBJECT m_object.
DO 3 TIMES.
DATA(l_handler) = NEW lcl_event_handler( i_raiser = m_object
i_number = sy-index ).
m_object->raise_event( ).
l_handler->free( ).
FREE l_handler.
ENDDO.
m_object->raise_event( ).
ENDMETHOD.
.........
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 |