‎2006 Aug 10 8:56 PM
I'm migrating a program from 4.6 to 5.0 version. On 4.6 the program shows a pushbutton with an icon. When you press the button the icon changes and other options are displayed on screen. I'm newby on abap so I don't know how it works.
But anyway it works on 5.0 too, but the button shows an extrange code inside instead of the icon.
Every example I found of pushbutton has a text assigned to it on initialization section, but I didn't found any example with icons to try to understand how it works.
Can anybody help me?
The button is shown by:
SELECTION-SCREEN: PUSHBUTTON 72(4) PB%EXCO USER-COMMAND EXPCOL.
Thanks.
Gastó
‎2006 Aug 10 8:58 PM
You can do it just like this.
report zrich_0001.
<b>type-pools: icon.</b>
selection-screen begin of block b1 with frame title text-001.
selection-screen pushbutton 5(20) gocfg user-command gocfg.
selection-screen end of block b1.
start-of-selection.
<b>at selection-screen output.
* Write pushbutton text
write icon_configuration as icon to gocfg.
concatenate gocfg 'Configuration' into gocfg
separated by space.</b>
Regards,
Rich Heilman
‎2006 Aug 10 8:58 PM
You can do it just like this.
report zrich_0001.
<b>type-pools: icon.</b>
selection-screen begin of block b1 with frame title text-001.
selection-screen pushbutton 5(20) gocfg user-command gocfg.
selection-screen end of block b1.
start-of-selection.
<b>at selection-screen output.
* Write pushbutton text
write icon_configuration as icon to gocfg.
concatenate gocfg 'Configuration' into gocfg
separated by space.</b>
Regards,
Rich Heilman
‎2006 Aug 10 9:01 PM
TABLES sscrfields.
TYPE-POOLS icon.
SELECTION-SCREEN:
BEGIN OF SCREEN 500 AS WINDOW TITLE title,
PUSHBUTTON 2(10) but1 USER-COMMAND cli1,
PUSHBUTTON 12(30) but2 USER-COMMAND cli2
VISIBLE LENGTH 10,
END OF SCREEN 500.
AT SELECTION-SCREEN.
CASE sscrfields.
WHEN 'CLI1'.
...
WHEN 'CLI2'.
...
ENDCASE.
START-OF-SELECTION.
title = 'Push button'.
but1 = 'Button 1'.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = icon_information
text = 'Button 2'
info = 'My Quickinfo'
IMPORTING
RESULT = but2
EXCEPTIONS
OTHERS = 0.
CALL SELECTION-SCREEN '0500' STARTING AT 10 10.
‎2006 Aug 10 9:01 PM
Also, try this sample program.
report zrich_0001.
type-pools: icon.
data: switch.
selection-screen begin of block b1 with frame title text-001.
selection-screen pushbutton 5(20) gocfg user-command gocfg.
selection-screen end of block b1.
start-of-selection.
at selection-screen output.
if switch = 'X'.
clear switch.
* Write pushbutton text
write icon_red_light as icon to gocfg.
concatenate gocfg 'Red Light' into gocfg
separated by space.
else.
switch = 'X'.
write icon_Green_light as icon to gocfg.
concatenate gocfg 'Green Light' into gocfg
separated by space.
endif.
Regards,
Rich Heilman
‎2006 Aug 16 3:18 PM