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 Dynamic Calculation

Former Member
0 Likes
1,618

Hi Everyone,

I have  a question regards to ALV and the requirement is as follows.

I am having some fields editable in ALV.Most of the other fields in the ALV are derived based on the Editable Fields(some calculation).

Now my requirement is, If the editable fields are changed,is there any way that the dependent or derived fields gets changed automaticaly based on the input.

EX :  

input1   input2   output

10         20        input1+input2

20        40        input1 of first row * input2 of second row

in the above example..if i change input1 of first row..it should reflect in output field dynamically.

Is there any way for this..Any assistance will help me a lot and appreciated.

Regards,

Surya Reddy.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,068

once the data is changed in alv, call the below bethod..which wil be having the changed data in the internal table.

It can be achieved with alv_grid->check_changed_data.

then change the internal table as required and use method to alv_grid->refresh_table_display to display the same.

  

4 REPLIES 4
Read only

naimesh_patel
Active Contributor
0 Likes
1,068

In DATA_CHANGED event, you can do the calculations and set the value for the other cells using the method, MODIFY_CELL of the object ER_DATA_CHANGED.

Something like this would help:

LOOP AT er_data_changed->mt_good_cells INTO lwa_good_cells.
  CASE lwa_good_cells-fieldname.
  WHEN 'ZEDIT_FIELD'.

  READ TABLE li_output INTO lwa_output INDEX lwa_good_cells-row_id.
  lv_Val1 = lv_edit_Field * 10.
  CALL METHOD er_data_changed->modify_cell
           EXPORTING
             i_row_id    = lwa_good_cells-row_id
             i_fieldname = 'ZZFLD1'
             i_value     = lv_val1.
ENDLOOP.

Regards,
Naimesh Patel

Read only

0 Likes
1,068

Hi Naimesh,

Thanks for the reply..But sorry am unable to understand.Could u pls describe the above.

Regards,

Surya Reddy.

Read only

Former Member
0 Likes
1,069

once the data is changed in alv, call the below bethod..which wil be having the changed data in the internal table.

It can be achieved with alv_grid->check_changed_data.

then change the internal table as required and use method to alv_grid->refresh_table_display to display the same.