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

SAP ABAP系统事件处理机制
本文详细解析了SAP ABAP应用服务器如何处理屏幕交互产生的系统事件,包括ControlFramework事件的注册与处理流程,以及系统事件如何在PAI执行前被触发,确保在自动字段检查之前进行。
在上个论题我已经讲叙关于SAP的Control Framework的事件注册,这里再讲解一下系统事件SAP的ABAP应用服务器是采用何种机制处理的。( http://blog.youkuaiyun.com/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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值