通过设置断点(IT_EVENT)我们可以查看17种事件:
1.CALLER_EXIT 2.USER_COMMAND
3.TOP_OF_PAGE 4.TOP_OF_COVERPAGE
5.END_OF_COVERPAGE 6.FOREIGN_TOP_OF_PAGE
7.FOREIGN_END_OF_PAGE 8.PF_STATUS_SET
9.LIST_MODIFY 10.TOP_OF_LIST
11.END_OF_PAGE 12.END_OF_LIST
13.AFTER_LINE_OUTPUT 14.BEFORE_LINE_OUTPUT
15.REPREP_SEL_MODIFY 16.SUBTOTAL_TEXT
17.GROUPLEVEL_CHANGE
具体函数实现:
DATA: IT_EVENT TYPE SLIS_T_EVENT."定义
* I_EVENT_EXIT TYPE SLIS_T_EVENT_EXIT.
DATA WA_EVENT LIKE LINE OF IT_EVENT.
***调用子程序
PERFORM SHIJIAN USING IT_EVENT."不加括号也行
***子程序
FORM SHIJIAN USING P_IT_EVENT TYPE SLIS_T_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = IT_EVENT
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT IT_EVENT INTO WA_EVENT WHERE NAME = 'USER_COMMAND'.
* IF WA_EVENT-NAME = 'USER_COMMAND'.
WA_EVENT-FORM = 'FRM_USERCOMM'.
* APPEND wa_event TO it_event.
MODIFY IT_EVENT FROM WA_EVENT TRANSPORTING FORM.
* ENDIF.
ENDLOOP.
ENDFORM.