‎2006 Nov 06 5:17 PM
Hello,
I have implemented OO ALV display and set a field as input field. How can I process all the entries after the user enters values at multiple lines and presses ENTER?
Thx in advance.
Ali
‎2006 Nov 06 5:28 PM
Hi Ali,
You should use the following method in order to get the selected rows.
data: ref_alv_grid TYPE REF TO cl_gui_alv_grid.
CALL METHOD ref_alv_grid->get_selected_rows
IMPORTING
et_row_no = lt_selected_rows.
you can also set a hanlder to the data_change event.
CLASS lcl_manejador_eventos DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_manejador_eventos DEFINITION
CLASS lcl_manejador_eventos IMPLEMENTATION.
METHOD handle_data_changed.
PERFORM handle_data_changed USING er_data_changed.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_manejador_eventos IMPLEMENTATION
FORM handle_data_changed USING p_er_data_changed
TYPE REF TO cl_alv_changed_data_protocol.
DATA: ls_mod_cell TYPE lvc_s_modi,
lv_value TYPE lvc_value.
LOOP AT p_er_data_changed->mt_mod_cells INTO ls_mod_cell.
.....
.....
ENDLOOP.
in order to set the handler you should do this before the set_table_for_first_display.
DATA ref_manejador_eventos TYPE REF TO lcl_manejador_eventos.
CREATE OBJECT ref_manejador_eventos.
SET HANDLER ref_manejador_eventos->handle_data_changed FOR ref_alv_grid.
I don't know if you already know how to get the ENTER. So I written it over.
Detects the ENTER
CALL METHOD ref_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Detects when you move to another cell after a data changed
CALL METHOD ref_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Regards,
Eric
Message was edited by: Eric Hernandez Pardo
‎2006 Nov 06 5:22 PM
Hi
U should use the event DATA_CHANGED to elaborate or check the new hits and active the event linked to attribute EVT_ENTER.
Max
‎2006 Nov 06 5:27 PM
‎2006 Nov 06 5:32 PM
Hi
See the program demo BCALV_EDIT_03.
To active the event for the ENTER key:
CALL METHOD <GRID>->REGISTER_EDIT_EVENT EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
Max
‎2006 Nov 06 5:28 PM
Hi Ali,
You should use the following method in order to get the selected rows.
data: ref_alv_grid TYPE REF TO cl_gui_alv_grid.
CALL METHOD ref_alv_grid->get_selected_rows
IMPORTING
et_row_no = lt_selected_rows.
you can also set a hanlder to the data_change event.
CLASS lcl_manejador_eventos DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_manejador_eventos DEFINITION
CLASS lcl_manejador_eventos IMPLEMENTATION.
METHOD handle_data_changed.
PERFORM handle_data_changed USING er_data_changed.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_manejador_eventos IMPLEMENTATION
FORM handle_data_changed USING p_er_data_changed
TYPE REF TO cl_alv_changed_data_protocol.
DATA: ls_mod_cell TYPE lvc_s_modi,
lv_value TYPE lvc_value.
LOOP AT p_er_data_changed->mt_mod_cells INTO ls_mod_cell.
.....
.....
ENDLOOP.
in order to set the handler you should do this before the set_table_for_first_display.
DATA ref_manejador_eventos TYPE REF TO lcl_manejador_eventos.
CREATE OBJECT ref_manejador_eventos.
SET HANDLER ref_manejador_eventos->handle_data_changed FOR ref_alv_grid.
I don't know if you already know how to get the ENTER. So I written it over.
Detects the ENTER
CALL METHOD ref_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Detects when you move to another cell after a data changed
CALL METHOD ref_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Regards,
Eric
Message was edited by: Eric Hernandez Pardo
‎2006 Nov 06 7:48 PM
Hi Ali,
If your question was respond don't forget to close this post and reward the helpful answers.
Regards,
Eric