前段时间,群里有人问过屏幕的展开和关闭。
写了个例子。
大概效果如下:
执行程序,默认如下
代码比较简单,如下:
*&---------------------------------------------------------------------*
*& Report YLM_0001
*& 选择屏幕的展开与关闭
*&---------------------------------------------------------------------*
*& http://blog.sina.com.cn/sapliumeng
*&---------------------------------------------------------------------*
REPORT YLM_0001
.
INCLUDE
.
TABLES SSCRFIELDS
.
"展开--关闭按钮
SELECTION-SCREEN : PUSHBUTTON
/2
(
10
) B_OPEN
USER-COMMAND F_OPEN
MODIF
ID M_O
,
"open
PUSHBUTTON
/2
(
10
) B_CLS
USER-COMMAND F_CLS
MODIF
ID M_C
.
"close
"选择屏幕
SELECTION-SCREEN
BEGIN
OF
BLOCK B01
WITH
FRAME
TITLE
TEXT
-
001
.
PARAMETERS : P_ID
TYPE STRING
MODIF
ID M_C
.
SELECTION-SCREEN
END
OF
BLOCK B01
.
PARAMETERS : P_FLG
TYPE
C
NO
-DISPLAY
.
INITIALIZATION .
"添加两个图标
CONCATENATE ICON_EXPAND
:
'打开'
''
INTO B_OPEN
,
'打开'
''
INTO B_OPEN
.
CONCATENATE ICON_COLLAPSE
:
'关闭'
''
INTO B_CLS
,
'关闭'
''
INTO B_CLS
.
"默认是 关闭状态,点打开才能看到选择屏幕
P_FLG
=
'X'
.
AT
SELECTION-SCREEN
.
CASE SSCRFIELDS
-UCOMM
.
WHEN
'F_OPEN'
.
"打开
CLEAR P_FLG
.
WHEN
'F_CLS'
.
"关闭
P_FLG
=
'X'
.
ENDCASE
.
AT
SELECTION-SCREEN
OUTPUT
.
LOOP
AT
SCREEN
.
"修改屏幕显示状态
PERFORM CLOSE_BLOCK
USING
: P_FLG
'M_O'
'X'
,
P_FLG
'M_C' SPACE
.
ENDLOOP
.
*&---------------------------------------------------------------------*
*& Form CLOSE_BLOCK
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->VALUE text
* -->(U_CLOSE_BLOCK) text
* -->U_MODIFY_ID text
* -->U_CONVERT text
*----------------------------------------------------------------------*
FORM CLOSE_BLOCK
USING
VALUE
(P_FLAG
)
LIKE P_FLG
P_MODIFY_ID
LIKE
SCREEN
-GROUP1
P_CONVERT
.
"显示内容标识
IF P_CONVERT
IS
NOT
INITIAL
.
IF P_FLAG
IS
INITIAL
.
P_FLAG
=
'X'
.
ELSE
.
CLEAR P_FLAG
.
ENDIF
.
ENDIF
.
IF
(
SCREEN
-GROUP1
= P_MODIFY_ID
)
AND
( P_FLAG
IS
NOT
INITIAL
)
.
SCREEN
-ACTIVE
=
'0'
.
MODIFY
SCREEN
.
ENDIF
.
ENDFORM .
"close_block
*&
*&
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT
INCLUDE
TABLES
"展开--关闭按钮
SELECTION-SCREEN :
"选择屏幕
SELECTION-SCREEN
PARAMETERS :
SELECTION-SCREEN
PARAMETERS :
INITIALIZATION .
AT
AT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
*
*
*
*
*----------------------------------------------------------------------*
FORM
ENDFORM .