今天做的一个项目中用到将SELECTION-SCREEN 展开和收起的功能,现总结如下:
首先
include .因为要用到 icon_data_area_expand 和icon_data_area_collapse
这两个图标,
其次:就干脆贴代码显示算了,语言能力太差了。
*&---------------------------------------------------------------------*
*& Report ZVOL_SCREEN_COLLAPSE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZVOL_SCREEN_COLLAPSE.
include .
SELECTION-SCREEN:BEGIN OF BLOCK bk1 WITH FRAME TITLE text-001.
SELECTION-SCREEN : PUSHBUTTON 50(10) volcano USER-COMMAND pbvol modif id NEW.
SELECTION-SCREEN:BEGIN OF LINE.
PARAMETERS: r1 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN:COMMENT 4(10) text-002 for field r1 modif id new.
PARAMETERS: R2 RADIOBUTTON GROUP gr1.
SELECTION-SCREEN:COMMENT 17(10) text-003 for field r1 modif id new.
SELECTION-SCREEN:END OF LINE.
SELECTION-SCREEN:BEGIN OF LINE.
PARAMETERS : c1 AS CHECKBOX DEFAULT 'X' modif id old.
SELECTION-SCREEN:COMMENT 4(20) text-004 modif id old.
PARAMETERS: V_TEXT(4) TYPE C modif id old.
SELECTION-SCREEN:end OF LINE.
SELECTION-SCREEN:END OF BLOCK bk1.
DATA : FULL(1).
AT SELECTION-SCREEN.
IF SY-UCOMM EQ 'PBVOL'.
IF FULL EQ SPACE.
FULL = 'X'.
ELSE.
FULL = ' '.
ENDIF.
ELSE.
EXIT.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
*
IF FULL EQ 'X'.
LOOP AT SCREEN.
if screen-group1 = 'OLD'.
screen-active = '0'.
screen-input = '0'.
screen-output = '0'.
modify screen.
endif.
ENDLOOP.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
NAME = icon_data_area_expand
* TEXT = 'niha'
INFO = 'expand'
ADD_STDINF = ' '
IMPORTING
RESULT = volcano
.
ELSE.
LOOP AT SCREEN.
if screen-group1 = 'OLD'.
screen-active = '1'.
screen-input = '1'.
screen-output = '1'.
modify screen.
endif.
ENDLOOP.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
NAME = icon_data_area_collapse
* TEXT = 'niha'
INFO = 'collapse'
ADD_STDINF = ' '
IMPORTING
RESULT = volcano
.
ENDIF.
几点注意事项:
1.modif id ,就是modification group id,会自动的 system table screen 的group1 里面。
2.对于FM icon_create 里面的RESULT = VOLCANO ,其中的VOLCANO就是你要改变图标的这个屏幕字段名称,
INFO = 'collapse' ,就是鼠标移到这个图标的附近时要显示的文字。
其余大家可以自己试验吧。
3.如果你发现你要显示的图标是一线乱7八拐的字符,那是因为你的字段长度太短了,不信你可以将
PUSHBUTTON 50(20) volcano
里面的20改为10,或更小试试?
阅读(3565) | 评论(0) | 转发(0) |