此类按钮定义保存在系统结构体 SSCRFIELDS 中,N 是一个整数类型的序号,按钮的描述保存在字段 SSCRFIELDS-FUNCTXT_0N 中,按钮的功能代码默认赋值为“FC0N”,保存在字段 SSCRFIELDS-UCOMM 中。下面是个简单的小示例:
*&---------------------------------------------------------------------*
*& Report ZJOI_TEST02
*&
*&---------------------------------------------------------------------*
REPORT ZJOI_TEST02.
TABLES SSCRFIELDS.
PARAMETERS PARM LIKE MARA_MATNR.
SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN FUNCTION KEY 2.
DATA: G_FLAG1 TYPE C,
G_FLAG2 TYPE I,
G_FLAG TYPE N,
G_STR TYPE STRING.
INITIALIZATION.
G_FLAG1 = 'X'.
MOVE 'BUTTON1' TO SSCRFIELDS-FUNCTXT_01.
MOVE '(@_@)' TO SSCRFIELDS-FUNCTXT_02.
AT SELECTION-SCREEN.
IF SSCRFIELDS-UCOMM = 'FC01' AND G_FLAG1 <> 'X'.
MESSAGE '"呜-呜-呜...' TYPE 'I'.
ENDIF.
IF SSCRFIELDS-UCOMM = 'FC01' AND G_FLAG1 = 'X'.
MESSAGE '(@_@)别点我,我是Button 1,再点我就哭了...' TYPE 'I'.
CLEAR G_FLAG1.
ENDIF.
IF SSCRFIELDS-UCOMM = 'FC02'.
IF G_FLAG2 = 0.
MESSAGE '(@_@)点我10下会有惊喜...' TYPE 'I'.
ELSEIF G_FLAG2 > 0 AND G_FLAG2 <> 10.
G_FLAG = G_FLAG2.
CONCATENATE '第' G_FLAG '下' INTO G_STR SEPARATED BY SPACE.
MESSAGE G_STR TYPE 'S'.
CLEAR: G_STR,G_FLAG.
ELSEIF G_FLAG2 = 10.
MESSAGE '(@_@)嗯,真乖,让你点,还真点10下...' TYPE 'I'.
CLEAR G_FLAG2.
ENDIF.
G_FLAG2 = G_FLAG2 + 1.
ENDIF.
----------------------------- Joi 2012/12/12 ----------------------------
阅读(1516) | 评论(0) | 转发(0) |