Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Set Handler for Protected Event

krishnannarayanan_nampoot
Active Participant
0 Kudos

Hi All,

I have a requirement to use a protected event of a class.

To do so i declared an event handler class which inherits the main class. The event to be handled is a protected event of the main class. So i declared the method to handle the event in the protected section of the hander class ( which as mentioned before inherits the main class ).

When i go for set handler it says event is unknonwn / protected / private. Its true.

But how to set handler for protected events of main class in handler class which inherits the main class.

Please help.

I am attaching the code here with.

 
*&---------------------------------------------------------------------*
*&  Include           ZMM208_CLS                                       *
*&---------------------------------------------------------------------*


*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver_maingrid DEFINITION
*----------------------------------------------------------------------*
*   Event Handler Class for Events of Main Grid ( CL_GUI_ALV_GRID )    *
*----------------------------------------------------------------------*
CLASS lcl_event_receiver_maingrid DEFINITION INHERITING FROM cl_gui_alv_grid.

  PUBLIC SECTION.

    METHODS
        handle_butn_click
             FOR EVENT button_click OF cl_gui_alv_grid
                IMPORTING es_row_no.
    METHODS
        handle_data_changed
           FOR EVENT data_changed OF cl_gui_alv_grid
              IMPORTING er_data_changed.
    METHODS
       lcl_event_receiver_maingrid .


*  PRIVATE SECTION.

  PROTECTED SECTION.
    METHODS
     handle_click
        FOR EVENT click_row_col OF cl_gui_alv_grid
            IMPORTING row_id.

ENDCLASS.                    "lcl_event_receiver_maingrid DEFINITION

DATA: event_recvr_maingrid TYPE REF TO lcl_event_receiver_maingrid.

*----------------------------------------------------------------------*
*       CLASS lcl_event_receiver_top_left IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver_maingrid IMPLEMENTATION.
  METHOD lcl_event_receiver_maingrid.
*    set HANDLER event_recvr_maingrid->click_row_col
*                                                FOR main_grid.
  ENDMETHOD.                    "lcl_event_receiver_maingrid
  METHOD handle_butn_click.
    PERFORM set_arrow USING es_row_no-row_id.
    PERFORM set_header.

  ENDMETHOD.                    "handle_butn_click

  METHOD handle_data_changed.
    PERFORM handle_data_changed USING er_data_changed.
    PERFORM set_arrow USING ls_mod_cell-row_id.
  ENDMETHOD.                    "handle_data_changed

* method handle_data_changed_finished.
* ENDMETHOD.

  METHOD handle_click.
    PERFORM set_arrow USING row_id.
  ENDMETHOD.                    "handle_click
ENDCLASS.                  "handle_btn_click

Message was edited by:

Narayanan K N

1 REPLY 1

krishnannarayanan_nampoot
Active Participant
0 Kudos

I think there is some problem with the ques, tats Y no attempts to answer.

The requirement was addressed in another way.

Thanks.