[英]CL_GUI_ALV_GRID editable field not refresh
I have an ALV grid with an editable field, if I check the data entered and display errors, the ALV updates, if I try to change the input data, other times the ALV does not update anymore.我有一个带有可编辑字段的 ALV 网格,如果我检查输入的数据并显示错误,则 ALV 会更新,如果我尝试更改输入数据,其他时候 ALV 不再更新。
The code in the PAI is: PAI 中的代码是:
ls_layout-cwidth_opt = abap_true.
CREATE OBJECT go_alv
EXPORTING
i_parent = cl_gui_custom_container=>screen0
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc EQ 0.
* Adapting field catalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZAMOUNT'
CHANGING
ct_fieldcat = lt_fieldcat.
IF sy-subrc EQ 0.
* Field catalog specifics
LOOP AT lt_fieldcat ASSIGNING <ls_fieldcat>.
IF <ls_fieldcat>-fieldname = 'DMBTR'.
<ls_fieldcat>-edit = abap_true.
ENDIF.
ENDLOOP.
ENDIF.
* Show data usig ALV class
go_alv->set_table_for_first_display(
EXPORTING
is_layout = ls_layout
CHANGING
it_outtab = gt_out
it_fieldcatalog = lt_fieldcat ).
go_alv->set_ready_for_input( EXPORTING
i_ready_for_input = 1 ).
CALL METHOD go_alv->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD go_alv->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
ENDIF.
The code in the PBO is: PBO 中的代码是:
IF go_alv IS NOT INITIAL.
CALL METHOD go_alv->check_changed_data( ).
PERFORM check_amounts TABLES gt_out
CHANGING gv_sum_amounts
gv_tot_amount.
CALL METHOD go_alv->refresh_table_display
EXPORTING
is_stable = VALUE #( row = abap_true
col = abap_true )
i_soft_refresh = 'X'.
cl_gui_cfw=>flush( ).
ENDIF.
In the perform check_amounts I populate a field of the ALV with the errors, if the user modifies the input field and the error is removed in the internal table but it is not shown in the ALV.在执行 check_amounts 中,如果用户修改了输入字段并且错误在内部表中被删除但它没有显示在 ALV 中,我会用错误填充 ALV 的字段。
I also tried to implement the data_change_finished method by calling the refresh inside but I have not solved the anomaly.我也尝试通过调用内部的刷新来实现data_change_finished方法,但我没有解决异常。
Can you help me?你能帮助我吗? Thanks
谢谢
I'm not quite sure if I understand your problem but here are some potential issues I see:我不太确定我是否理解您的问题,但这里有一些我看到的潜在问题:
I'd try to define a local class to handle the data_changed and data_changed_finished events and put the check_amount and refresh in the method for the data_changed_finished event.我会尝试定义一个本地 class 来处理 data_changed 和 data_changed_finished 事件,并将 check_amount 和 refresh 放入 data_changed_finished 事件的方法中。 Maybe some of this helps you?
也许其中一些对您有帮助? If you have any questions about any of this, let me know and I can go into more detail.
如果您对此有任何疑问,请告诉我,我可以更详细地了解 go。
regards问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.