2008 Mar 09 5:45 AM
hi,
Hi,
I´m working with CL_GUI_ALV_GRID and use the following methods:
- CALL METHOD grid->set_table_for_first_display, to display my ALV;
- CALL METHOD grid->get_selected_rows, to select the rows.
But i have some fields that can suffer alterarions in the values...
How can i recoup this values from the screen? Is there any method to do this?
thnks.
2008 Mar 09 8:52 AM
HI,
You neeed to handle the change event.
Example below...
Definition.
Code:
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed
OF cl_gui_alv_grid
IMPORTING er_data_changed.
ENDCLASS. "lcl_event_handler DEFINITION
Implement
Code:
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_data_changed.
CONSTANTS:
lc_wa(11) TYPE c VALUE '<LW_SDITM>-'.
DATA:
l_subrc TYPE sy-subrc,
l_variable TYPE string,
lw_good TYPE lvc_s_modi.
FIELD-SYMBOLS:
<lw_sditm> TYPE /powercor/sditm,
<lw> TYPE ANY. "Generic field symbol
LOOP AT er_data_changed->mt_good_cells INTO lw_good.
Update the internal table
READ TABLE t_item_sel ASSIGNING <lw_sditm> INDEX lw_good-row_id.
IF sy-subrc EQ 0.
CONCATENATE lc_wa lw_good-fieldname INTO l_variable.
ASSIGN (l_variable) TO <lw>.
IF sy-subrc EQ 0.
<lw> = lw_good-value.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_handler IMPLEMENTATION
Set for your grid.
Code:
SET HANDLER g_handler->handle_data_changed FOR my_grid.
Cheers,
Chandra Sekhar.