2010 Apr 22 8:37 AM
hi,
i have to add expand button in the selection screen, afterwich, the expand button will be replaced by collapse button,
any idea?!
thanks
2010 Apr 22 9:30 AM
You should define
[DefineDynamicFunctionText|http://help.sap.com/erp2005_ehp_04/helpdata/EN/d1/801e3a454211d189710000e8322d00/frameset.htm]. for this you need to define a program field e.g data: icon type smp_dyntxt. Also you should define TYPE-POOLS: ICON. then at run time;
icon = "@3S@". (Which means expand)
After push expand button in user command you shoul assign collapse code to icon variable;
icon = "@3T@".
I tried and I see it works.
2010 Apr 22 9:30 AM
You should define
[DefineDynamicFunctionText|http://help.sap.com/erp2005_ehp_04/helpdata/EN/d1/801e3a454211d189710000e8322d00/frameset.htm]. for this you need to define a program field e.g data: icon type smp_dyntxt. Also you should define TYPE-POOLS: ICON. then at run time;
icon = "@3S@". (Which means expand)
After push expand button in user command you shoul assign collapse code to icon variable;
icon = "@3T@".
I tried and I see it works.
2010 Apr 22 10:58 AM
Check this code..............
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.