13/09/2010

Expand- Collapse Button in Selection Screen


REPORT ZRR_SAMPLE.

DATA: wf_ucomm TYPE sy-ucomm.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECTION-SCREEN PUSHBUTTON /01(30) but1 USER-COMMAND but1.
SELECTION-SCREEN PUSHBUTTON /01(30) but2 USER-COMMAND but2.
PARAMETERS: p_test TYPE c.
SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = 'ICON_EXPAND'
IMPORTING
RESULT = but1
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = 'ICON_COLLAPSE'
IMPORTING
RESULT = but2
EXCEPTIONS
OTHERS = 0.

AT SELECTION-SCREEN.

IF sy-ucomm EQ 'BUT1'.
wf_ucomm = 'BUT1'.
ELSEIF sy-ucomm EQ 'BUT2'.
wf_ucomm = 'BUT2'.
ENDIF.

AT SELECTION-SCREEN OUTPUT.

IF wf_ucomm IS INITIAL.
LOOP AT SCREEN.
IF screen-name CS 'P_TEST' OR
screen-name EQ 'BUT2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF wf_ucomm EQ 'BUT1'.
LOOP AT SCREEN.
IF screen-name CS 'P_TEST' OR
screen-name EQ 'BUT2'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
IF screen-name EQ 'BUT1'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ELSEIF wf_ucomm EQ 'BUT2' .
LOOP AT SCREEN.
IF screen-name CS 'P_TEST' OR
screen-name EQ 'BUT2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
IF screen-name EQ 'BUT1'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

Nenhum comentário:

Postar um comentário