本文主要是介绍ALV中data changed事件刷新内表,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
文章目录
- 1.Introduction
- 2 Example
- 3 Summary
- 3.1 Add the code
- 3.2 Take function.
- 3.3 Input field
1.Introduction
In the abap how to refresh alv internal table in the alv by click ‘x’? I will demostrate it in next example. The purpose is that add the other logic in ohter alv field.
2 Example
data it_events type table of slis_alv_event.data lw_event type slis_alv_event.data lw_guid type lvc_s_glay.lw_guid-edt_cll_cb = 'X'.lw_event-name = 'DATA_CHANGED'.lw_event-form = 'FRM_DATA_CHANGE'.append lw_event to it_events.call function 'REUSE_ALV_GRID_DISPLAY_LVC'exportingi_callback_program = sy-repidi_callback_pf_status_set = 'FRM_USER_STATUS'i_callback_user_command = 'FRM_USER_COMMAND'is_layout_lvc = ls_layoutit_fieldcat_lvc = lt_fieldcati_save = 'A'i_grid_settings = lw_guidit_events = it_eventstablest_outtab = gt_alvexceptionsprogram_error = 1others = 2.
form frm_data_change using rr_data_changed type ref to cl_alv_changed_data_protocol.data: l_name type char20,lw_stable type lvc_s_stbl,ls_cells type lvc_s_modi.data: l_grid type ref to cl_gui_alv_grid. "用来获取最新值data l_message type char100.data:l_date type sy-datum.data: lt_ztfi083b like table of ztfi083b.data: lw_ztfi083b like line of lt_ztfi083b .data:lv_change_flag(1).
*设置ALV刷新时的焦点,避免每次刷新都自动跳到第一列lw_stable-row = 0.lw_stable-col = 0.field-symbols: <dyn_wa> type any,<fs> type any.* 取当前ALV信息call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'importinge_grid = l_grid.loop at rr_data_changed->mt_mod_cells into ls_cells. "读取被修改了的单元格read table gt_alv into gw_alv index ls_cells-row_id.case ls_cells-fieldname.when 'SEL'.gw_alv-sel = ls_cells-value.if s_time is not initial.clear:l_date,lw_ztfi083b.select single * into lw_ztfi083bfrom ztfi083bwhere zlcbh = gw_alv-zlcbh.if lw_ztfi083b is not initial.gw_alv-datbi = lw_ztfi083b-datna + s_time .l_date = sy-datum.if gw_alv-datbi < l_date.gw_alv-zenid = 'N'.else.gw_alv-zenid = 'Y'.endif.endif.endif.when others.endcase.modify gt_alv from gw_alv index ls_cells-row_id .endloop.call method l_grid->refresh_table_displayexportingis_stable = lw_stable. "刷新ALVclear rr_data_changed->mt_good_cells.endform.
3 Summary
3.1 Add the code
We add it and the data can be changed.
data lw_guid type lvc_s_glay.lw_guid-edt_cll_cb = 'X'.
3.2 Take function.
The FM ' REUSE_ALV_GRID_DISPLAY ' is not use event .
3.3 Input field
As long as you input field in the alv, we will write logic in the field. Otherwrise it is empty.
这篇关于ALV中data changed事件刷新内表的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!