【ABAP】非OO普通ALV回车事件捕捉方法

ALV事件添加参数

  " 回车事件抓取
  REFRESH gt_events.
  CLEAR gs_events.
  gs_events-name = 'CALLER_EXIT'.
  gs_events-form = 'CALLER_EXIT'.
  APPEND gs_events TO gt_events.

添加参数对用的FORM

FORM caller_exit USING e_grid TYPE slis_data_caller_exit.
  " 回车事件抓取
  DATA lv_ucomm TYPE sy-ucomm.

  CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
      e_grid = g_grid.

  CALL METHOD g_grid->register_edit_event     "注册GRID事件 修改单元格后事件
    EXPORTING
      i_event_id = cl_gui_alv_grid=>mc_evt_enter"事件回车触发
    EXCEPTIONS
      error      = 1
      OTHERS     = 2.


  CREATE OBJECT g_event_receiver.
  SET HANDLER g_event_receiver->handle_modify FOR g_grid.
  SET HANDLER g_event_receiver->data_changed_finished FOR g_grid.

ENDFORM.

类和方法写法与OOALV相同
在调用结束时,调用结束方法,更新ALV的方法

  METHOD data_changed_finished.
          " 内表更新至ALV
      CALL METHOD g_grid->refresh_table_display.
  ENDMETHOD. 

你可能感兴趣的:(sap,abap,abap,sap)