Application Development and Automation 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: 
Read only

processing input fields on OO ALV display

Former Member
0 Likes
1,275

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
884

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

5 REPLIES 5
Read only

Former Member
0 Likes
884

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

Read only

0 Likes
884

Hi;

Thx for the answer. Can u pls give examples.

Regards

Ali

Read only

0 Likes
884

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

Read only

Former Member
0 Likes
885

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

Read only

Former Member
0 Likes
884

Hi Ali,

If your question was respond don't forget to close this post and reward the helpful answers.

Regards,

Eric