12
返回列表 发新帖
楼主: xiebinren

紧急求救:ABAP ON CHANGE OF 的语法

[复制链接]
论坛徽章:
1
授权会员
日期:2008-07-29 13:58:59
11#
 楼主| 发表于 2008-6-23 13:37 | 只看该作者
原帖由 jltt 于 2008-6-23 11:57 发表
当用户提交时
判断,当前该字段中的值与初始值之间是否相同
如果不同,则触发该事件。

谢谢老大,那我理解正确了

使用道具 举报

回复
论坛徽章:
1
授权会员
日期:2008-10-10 23:12:07
12#
发表于 2008-7-2 20:54 | 只看该作者
复习一下知识

使用道具 举报

回复
论坛徽章:
0
13#
发表于 2010-3-28 22:29 | 只看该作者
ON CHANGE OF



Syntax
ON CHANGE OF dobj [OR dobj1 [OR dobj2] ... ].
  statement_block
ENDON.



Effect:
The statements ON CHANGE OF and ENDON, which are forbidden in classes, define a control structure that can contain a statement block statement_block. After ON CHANGE OF, any number of data objects dobj1, dobj2... of any data type can be added, linked by OR.

The first time a statement ON CHANGE OF is executed, the statement block is executed if at least one of the specified data objects is not initial. The statement block is executed for each additional execution of the same statement ON CHANGE OF, if the content of one of the specified data objects has been changed since the last time the statement ON CHANGE OF was executed.

For each time the statement ON CHANGE OF is executed, the content of all the specified data objects is saved as an auxiliary variable internally in the global system. The auxiliary variable is linked to this statement and cannot be accessed in the program. The auxiliary variables and their contents are retained longer than the lifetime of procedures. An auxiliary variable of this type can only be initialized if its statement ON CHANGE OF is executed while the associated data object is initial.

Note:
This control structure, which is forbidden in classes, is particularly prone to errors and should be replaced by branches with explicitly declared auxiliary variables.

Example:
In a SELECT loop, a statement block should only be executed if the content of the column CARRID has changed.

DATA spfli_wa TYPE spfli.
SELECT *
       FROM spfli
       INTO spfli_wa
       ORDER BY carrid.
  ...
  ON CHANGE OF spfli_wa-carrid.
    ...
  ENDON.
  ...
ENDSELECT.

The following section of a program shows how the ON control structure can be replaced by an IF control structure with an explicit auxiliary variable carrid_buffer.

DATA carrid_buffer TYPE spfli-carrid.
CLEAR carrid_buffer.
SELECT *
       FROM spfli
       INTO spfli_wa
       ORDER BY carrid.
  ...
  IF spfli_wa-carrid <> carrid_buffer.
    carrid_buffer = spfli_wa-carrid.
    ...
  ENDIF.
  ...
ENDSELECT.


////////////////////////////////////////////////
ON CHANGE OF dobj [OR dobj1 [OR dobj2] ... ].
  statement_block
ENDON

意思是说 dobj 或 dobj1 或 dobj2 发生变化时候,执行statement_block

使用道具 举报

回复
论坛徽章:
22
奥运会纪念徽章:艺术体操
日期:2008-06-30 23:50:552010广州亚运会纪念徽章:体操
日期:2011-02-17 15:52:102011新春纪念徽章
日期:2011-02-18 11:42:50ITPUB十周年纪念徽章
日期:2011-11-01 16:23:262012新春纪念徽章
日期:2012-01-04 11:51:22ITPUB 11周年纪念徽章
日期:2012-10-09 18:07:312013年新春福章
日期:2013-02-25 14:51:24法拉利
日期:2013-09-23 21:25:502014年新春福章
日期:2014-02-18 16:42:02马上有房
日期:2014-02-18 16:42:02
14#
发表于 2010-3-28 22:41 | 只看该作者
这是已经废弃的语法。

使用道具 举报

回复
论坛徽章:
8
2010新春纪念徽章
日期:2010-03-01 11:08:29ITPUB9周年纪念徽章
日期:2010-10-08 09:32:252011新春纪念徽章
日期:2011-01-04 10:36:462011新春纪念徽章
日期:2011-02-18 11:43:32ITPUB十周年纪念徽章
日期:2011-11-01 16:24:04咸鸭蛋
日期:2012-03-16 17:18:492013年新春福章
日期:2013-02-25 14:51:24咸鸭蛋
日期:2013-05-31 14:41:17
15#
发表于 2010-3-29 08:27 | 只看该作者
拓展

使用道具 举报

回复
论坛徽章:
4
2010新春纪念徽章
日期:2010-01-04 08:33:082010新春纪念徽章
日期:2010-03-01 11:19:07参与SAP云计算之旅活动纪念
日期:2011-05-17 13:35:45ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
16#
发表于 2010-5-26 09:57 | 只看该作者
原帖由 lhx20 于 2010-3-28 22:41 发表
这是已经废弃的语法。

已经废弃了? 那用来替代的新语法是什么啊?

使用道具 举报

回复
论坛徽章:
110
IT宝贝
日期:2011-08-15 22:17:21IT宝贝
日期:2014-11-13 09:45:37马上有对象
日期:2015-01-05 10:24:17懒羊羊
日期:2015-03-04 14:52:112015年新春福章
日期:2015-03-06 11:58:18喜羊羊
日期:2015-06-17 15:29:51
17#
发表于 2010-5-26 10:55 | 只看该作者
原帖由 lhx20 于 2010-3-28 22:41 发表
这是已经废弃的语法。

废弃了?我才知道这句啊,觉得挺有用的

使用道具 举报

回复
论坛徽章:
5
生肖徽章2007版:鼠
日期:2009-03-10 21:26:282009日食纪念
日期:2009-07-22 09:30:00参与WIN7挑战赛纪念
日期:2009-11-09 11:50:092010新春纪念徽章
日期:2010-01-04 08:33:08ITPUB9周年纪念徽章
日期:2010-10-08 09:31:21
18#
发表于 2010-5-26 10:59 | 只看该作者
是不是有点像 AT NEW

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表