TABLES:sscrfields.
DATA ucm LIKE sy-ucomm.
DATA ucm_sta LIKE sy-ucomm.
PARAMETERS field1(15) TYPE c MODIF ID m1.
PARAMETERS field2(15) TYPE c MODIF ID m2.
SELECTION-SCREEN PUSHBUTTON /1(49) button1 USER-COMMAND com1 MODIF ID m1.
SELECTION-SCREEN PUSHBUTTON /1(49) button2 USER-COMMAND com2 MODIF ID m2.
INITIALIZATION.
DATA: icon_name TYPE iconname,
button_text(30) TYPE c,
quickinfo LIKE smp_dyntxt-quickinfo,
icon_str(255) TYPE c.
icon_name = 'ICON_ARROW_RIGHT'. " 'ICON_DISPLAY_MORE'.
button_text = 'switch to screen 1'.
CONCATENATE button_text text-akt
INTO quickinfo
SEPARATED BY space.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_name
text = button_text
info = quickinfo
* ADD_STDINF = 'X'
IMPORTING
RESULT = icon_str
EXCEPTIONS
OTHERS = 0. "not interested in errors
* place text and icon on button
button1 = icon_str.
* Setup button 2 (Date period)
icon_name = 'ICON_ARROW_LEFT'.
button_text = 'switch to screen 2'.
CONCATENATE button_text text-akt
INTO quickinfo
SEPARATED BY space.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_name
text = button_text
info = quickinfo
* ADD_STDINF = 'X'
IMPORTING
RESULT = icon_str
EXCEPTIONS
OTHERS = 0. "not interested in errors
* place text and icon on button
button2 = icon_str.
AT SELECTION-SCREEN.
ucm = sscrfields-ucomm.
AT SELECTION-SCREEN OUTPUT.
CASE ucm.
WHEN ''.
LOOP AT SCREEN.
IF screen-group1 = 'M2'.
screen-active = '0'.
ELSE.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
WHEN 'COM1'.
LOOP AT SCREEN.
IF screen-group1 = 'M1 '.
screen-active = '0'.
ELSE.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ucm_sta = ucm.
WHEN 'COM2'.
LOOP AT SCREEN.
IF screen-group1 = 'M2'.
screen-active = '0'.
ELSE.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ucm_sta = ucm.
ENDCASE.
START-OF-SELECTION.
IF ucm_sta = '' OR ucm_sta ='COM2'.
WRITE:/ 'screen1:',field1.
ELSE.
WRITE:/ 'screen2:',field2.
ENDIF.