00 回车
*----------------------------------------------------------------------* * CLASS lcl_alv_receiver DEFINITION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_alv_receiver DEFINITION. PUBLIC SECTION. METHODS: handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after e_ucomm, handle_data_changed200 FOR EVENT data_changed OF cl_gui_alv_grid IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after e_ucomm. ENDCLASS. "lcl_event_receiver DEFINITION *----------------------------------------------------------------------* * CLASS lcl_alv_receiver IMPLEMENTATION *----------------------------------------------------------------------* * *----------------------------------------------------------------------* CLASS lcl_alv_receiver IMPLEMENTATION. METHOD handle_data_changed. PERFORM handle_data_changed USING er_data_changed. ENDMETHOD. "handle_data_changed METHOD handle_data_changed200. PERFORM handle_data_changed200 USING er_data_changed. ENDMETHOD. "handle_data_changed ENDCLASS. "lcl_ALV_event_receiver DATA:g_alv_application TYPE REF TO lcl_alv_receiver. CREATE OBJECT g_alv_application. CALL METHOD alv_grid_200->set_table_for_first_display EXPORTING is_layout = layout_200 it_toolbar_excluding = gt_exclude CHANGING it_outtab = gt_alv1[] it_fieldcatalog = fcat_200[]. SET HANDLER g_alv_application->handle_data_changed200 FOR alv_grid_200. CALL METHOD alv_grid_200->register_edit_event "注册更新事件 EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_modified. CALL METHOD alv_grid_200->set_ready_for_input EXPORTING i_ready_for_input = 1. *&---------------------------------------------------------------------* *& Form handle_data_changed *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_ER_DATA_CHANGED text *----------------------------------------------------------------------* FORM handle_data_changed USING p_er_data_changed TYPE REF TO cl_alv_changed_data_protocol. DATA:mod_data TYPE lvc_t_modi, wa_mod_data TYPE lvc_s_modi. DATA:l_note. mod_data = p_er_data_changed->mt_mod_cells. LOOP AT mod_data INTO wa_mod_data WHERE fieldname = 'JSZOJ'. READ TABLE gt_alv INDEX wa_mod_data-row_id. IF sy-subrc EQ 0. gt_alv-shuij = wa_mod_data-value * 17 / 100. gt_alv-yfzhk = wa_mod_data-value + gt_alv-shuij. gt_alv-yfzcy = gt_alv-yfzhk - ( gt_alv-wrbtr * 117 / 100 ). gt_alv-shjcy = gt_alv-shuij - ( gt_alv-wrbtr * 17 / 100 ). gt_alv-matcy = gt_alv-yfzcy - gt_alv-shjcy. MODIFY gt_alv FROM gt_alv INDEX wa_mod_data-row_id. ENDIF. l_note = 'X'. ENDLOOP. IF l_note = 'X'. CALL METHOD alv_grid_100->refresh_table_display. CLEAR:l_note. ENDIF. ENDFORM. "handle_data_changed