Anda di halaman 1dari 2

*----- Top Include

*---Class for editable ALV Logic


CLASS lcl_grid_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS.

"lcl_grid_event_receiver DEFINITION

*----------------------------------------------------------------------*
*
CLASS lcl_grid_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_grid_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
*event is ttriggered when data is changed in the output
PERFORM f_check_data USING er_data_changed.
ENDMETHOD.
ENDCLASS.

"lcl_grid_event_receiver IMPLEMENTATION

DATA:wf_event_receiver TYPE REF TO lcl_grid_event_receiver.


*&---------------------------------------------------------------------*
*&
Form CHECK_DATA
*&---------------------------------------------------------------------*
*
Check Data for Change in Editable ALV
*----------------------------------------------------------------------*
*
-->P_ER_DATA_CHANGED text
*----------------------------------------------------------------------*
FORM f_check_data USING
p_er_data_changed TYPE REF TO
cl_alv_changed_data_protocol.

CALL METHOD wf_main->register_edit_event


EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
error
= 1
OTHERS
= 2.

CALL METHOD p_er_data_changed->refresh_protocol


.

LOOP AT p_er_data_changed->mt_mod_cells INTO lwf_mod_cell.


Endloop.

lwf_stable-row = 'X'.
lwf_stable-col = 'X'.

*
*
*
*
*
*

CALL METHOD wf_main->refresh_table_display


EXPORTING
is_stable
= lwf_stable
I_SOFT_REFRESH =
EXCEPTIONS
FINISHED
= 1
others
= 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD cl_gui_cfw=>flush.

ENDFORM.

" CHECK_DATA

*----After GRID Creation & Set Table for First Display


CALL METHOD p_grd->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
error
= 1
OTHERS
= 2.
CREATE OBJECT wf_event_receiver.
SET HANDLER wf_event_receiver->handle_data_changed FOR p_grd.
CALL METHOD cl_gui_cfw=>flush.

*---After Above Statements Creation Call the Below Method


*---PBO Module
CALL METHOD wf_main->set_ready_for_input
EXPORTING
i_ready_for_input = 1.