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

Refresh total value in alv grid

Former Member
0 Likes
3,970

Hi gurus!

I have an editable alv grid. One of the columns in it is updated automatically when I enter some digits in other fields according to their values. The update is made with the help of data_changed event. Then I made a total for that field. But it isn't updated automatically even if I use refresh_table_display method. How can I achieve this?

Thanks, points will be rewarded!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,845

Hi Pavel,

The standard functionality of totalling the values is done after the code written after the data_changed event is triggered and the changes made to the data in the layout is also reflected only after the data_changed event is complete.

Hi gurus!

I have an editable alv grid. One of the columns in it is updated automatically when I enter some digits in other fields according to their values. The update is made with the help of data_changed event. Then I made a total for that field. But it isn't updated automatically even if I use refresh_table_display method. How can I achieve this?

Thanks, points will be rewarded!

7 REPLIES 7
Read only

Former Member
0 Likes
1,845

hi Pavel,

In the subroutine, are you setting the field selfield-refresh = 'X' ?

if not try the following logic:


FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM 
    SELFIELD TYPE SLIS_SELFIELD.
case ucomm.
when 'F8'...
...
endcase.
 
selfield-refresh = 'X'.
endform.

hope this helps,

Sajan Joseph.

Read only

0 Likes
1,845

Hi!

You've misunderstood. I use handle_data_changed event of cl_gui_alv_grid. And there is no selfield parameter there.

Read only

Former Member
0 Likes
1,845

Hi Pavel,

Please check using this in the handle_data_changed event

CALL METHOD ER_DATA_CHANGED->MODIFY_CELL

EXPORTING

I_ROW_ID = Rowid

I_FIELDNAME = field name

I_VALUE = field value to be updated.

Read only

0 Likes
1,845

Hi! No, this didn't help me. My question is why my total doesn't update when I change some editable data in ALV Grid?

I've noticed that when I change the editable data for the <b>second time</b> the total is updated in accordance with the data that I entered for the <b>first time</b>! Where should I find my problem?

Read only

Former Member
0 Likes
1,846

Hi Pavel,

The standard functionality of totalling the values is done after the code written after the data_changed event is triggered and the changes made to the data in the layout is also reflected only after the data_changed event is complete.

Read only

Former Member
0 Likes
1,845

also use CHECK_CHANGED_DATA and checkout if it works

Read only

1,845

Thanks to all. I found the solution. I executed grid->refresh_table_display in the data_changed_finished event.