2012 May 07 7:22 PM
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.
2012 May 17 3:05 PM
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.
2012 May 07 8:14 PM
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
2012 May 08 7:37 AM
Hi Naimesh,
Thanks for the reply..But sorry am unable to understand.Could u pls describe the above.
Regards,
Surya Reddy.
2012 May 17 3:05 PM
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.
2012 May 17 3:28 PM