ABAP--关于SAP的Control Framework的系统事件ABAP处理机制的学习

在上个论题我已经讲叙关于SAP的Control Framework的事件注册,这里再讲解一下系统事件SAP的ABAP应用服务器是采用何种机制处理的。( http://blog.csdn.net/CompassButton/archive/2009/08/04/4407993.aspx )

SAP ABAP的任何一个屏幕交互都会在屏幕PAI开始执行前隐式调用调用SAPMSSYD的Module:%_ctl_input。
处理步骤如下:
1)在%_ctl_input中根据OK_CODE判断是否是Control Framework的事件,如果是,则调用的sapfguicntl单元的control_dispatch子过程

*==> Dispatch Control Event (%_GC) or Shell Event (%_GS)
elseif my_ucomm(4) = '%_GC' or my_ucomm(4) = '%_GS'.
call 'DYNP_GET_SUBSCREEN'. "Only Once: On Mainscreen
if sy-subrc = 2.
perform control_dispatch(sapfguicntl)
using my_ucomm
if found. .
endif.
2)在control_dispatch中将调用sapfguicntl_cfw单元的control_dispatch子过程
*=======================================================================
* C O N T R O L D I S P A T C H
*-----------------------------------------------------------------------
* Called by Dynpro Main Step "Control Input" (SAPMSSYD form %_ctl_input)
* OK_Code is '%_GC ...' (Control Event) or
* OK_Code is '%_GS ...' (Shell Event) or
*=======================================================================
form control_dispatch using cd_ok_code.
perform control_dispatch(sapfguicntl_cfw)
using cd_ok_code
if found. .
endform. "control_event_dispatch

3)在control_dispatch将会调用cl_gui_cfw的方法DISPATCH_SYSTEM_EVENTS根据事件注册的内表CFW_SYSTEMEVENTS 判断是否是存在对应系统事件。如果有,则进行系统事件相应的代码处理。否则就退出,进入屏幕的PAI处理。

注意:从上面的论述系统事件的处理在PAI执行前,也就说明屏幕字段未读取用户输入值,也就正好印证了SAP关于系统消息的说明。
System events are is triggered before any automatic field checks (for example, required fields) have taken place on the screen, and before any field transport. The PAI and PBO events are not triggered. Consequently, you cannot access any values that the user has just changed on the screen. Furthermore, there is no field transport back to the screen after the event, so values that you have changed in the event handling are not updated on the screen.

你可能感兴趣的:(应用服务器,shell,SAP,System,input,events)