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

ALV edit not capturing new value

Former Member
0 Likes
1,793

Hi

In my alv i have made one field as editable..when i edit the field and click save button the control comes to below code.

CALL METHOD gro_grid->get_selected_rows

IMPORTING

et_index_rows = gwa_selected_rows.

*Through the index capturing the values of selected rows

LOOP AT gwa_selected_rows INTO gv_selected_rows.

READ TABLE git_data INTO gwa_data INDEX gv_selected_rows-index.

here git_data is the internal table given to alv grid...i nthe above read stmt..gwa_data gives the value in field as old one..its not capturing the new value..how to solve this ..pls help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,263

Hi Ganesh,

Use this.

DATA:

lv_ref_grid TYPE REF TO cl_gui_alv_grid.

CLEAR : gv_tcode.

*-- to ensure that only new processed data is displayed

IF lv_ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = lv_ref_grid.

ENDIF.

IF NOT lv_ref_grid IS INITIAL.

CALL METHOD lv_ref_grid->check_changed_data.

ENDIF.

THis will solve your problem.

Regards,

Vijay

Hi

In my alv i have made one field as editable..when i edit the field and click save button the control comes to below code.

CALL METHOD gro_grid->get_selected_rows

IMPORTING

et_index_rows = gwa_selected_rows.

*Through the index capturing the values of selected rows

LOOP AT gwa_selected_rows INTO gv_selected_rows.

READ TABLE git_data INTO gwa_data INDEX gv_selected_rows-index.

here git_data is the internal table given to alv grid...i nthe above read stmt..gwa_data gives the value in field as old one..its not capturing the new value..how to solve this ..pls help

2 REPLIES 2
Read only

Former Member
0 Likes
1,264

Hi Ganesh,

Use this.

DATA:

lv_ref_grid TYPE REF TO cl_gui_alv_grid.

CLEAR : gv_tcode.

*-- to ensure that only new processed data is displayed

IF lv_ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = lv_ref_grid.

ENDIF.

IF NOT lv_ref_grid IS INITIAL.

CALL METHOD lv_ref_grid->check_changed_data.

ENDIF.

THis will solve your problem.

Regards,

Vijay

Read only

awin_prabhu
Active Contributor
0 Likes
1,263

Hi,

Use event data_changed.

When 'SAVE' is pressed, call check_changed_data( ) which will trigger event data_changed.

Inside handler method copy the modified cells to table.

*PAI

When 'SAVE'.

g_o_grid->check_changed_data( ). " It triggers event 'data_changed'.

LOOP AT g_t_modcells INTO g_r_modcells. " Loop at modified cells table

READ TABLE git_data INTO gwa_data INDEX g_r_modcells-row_id . " <---- Ur code

.......

ENDLOOP.

clear: g_t_modcells[],g_t_modcell[].

*Declare data for handler method.

Data: g_t_modcells type lvc_t_modi,

g_t_modcell type lvc_t_modi.

*Declare handler method for event 'data_changed'.

METHODS: data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed.

*Handler method implementation

METHOD data_changed.

IF er_data_changed->mt_good_cells[] IS NOT INITIAL.

g_t_modcell[] = er_data_changed->mt_good_cells[].

APPEND LINES OF g_t_modcell TO g_t_modcells. " Modified cells are copied to table g_t_modcells[]

ENDIF.

ENDMETHOD.

Thanks,