关于AT New的几个说明

1、AT New事件触发说明
如 AT New f.
f 是内表的一个字段,当f字段或者f字段左边的字段内容发生变化是该事件后面的语句都会执行。
TYPES: BEGIN OF COMPANIES_TYPE,
        NAME(30),
        PRODUCT(20),
        SALES TYPE I,
      END   OF COMPANIES_TYPE.

DATA: COMPANIES TYPE STANDARD TABLE OF COMPANIES_TYPE WITH
                     NON-UNIQUE DEFAULT KEY INITIAL SIZE 20,
      WA_COMPANIES TYPE COMPANIES_TYPE.

...

LOOP AT COMPANIES INTO WA_COMPANIES.
  AT NEW PRODUCT.
    NEW-PAGE.
    WRITE / WA_COMPANIES-NAME WA_COMPANIES-PRODUCT.
  ENDAT.
  WRITE: / WA_COMPANIES-PRODUCT, WA_COMPANIES-SALES.
  AT END OF NAME.
    SUM.
    WRITE: / WA_COMPANIES-NAME, WA_COMPANIES-SALES.
  ENDAT.
ENDLOOP.

这个样例当name变化时,AT new事件也会执行。

2、AT New 发生时工作区的字段的值

  • All character type fields (on the right) are filled with "*" after the current control level key.
  • All other fields (on the right) are set to their initial values after the current control level key.    
  • posted on 2007-03-08 17:18  毛小娃  阅读(112)  评论(0编辑  收藏  举报

    导航