Thursday, February 10, 2011

Add icon to button

When create a button on selection screen,

SELECTION-SCREEN PUSHBUTTON /10(25) b_test USER-COMMAND test.

INITIALIZATION.
b_test = 'TEST'.









We only got the plain button.




But I need a user-friendly button that has an icon in the button. We can do by call function 'ICON_CREATE' as example below,

SELECTION-SCREEN PUSHBUTTON /10(25) b_test2 USER-COMMAND test2.

INITIALIZATION.
* add text and icon to push buttonDATA: icon_str(255) TYPE c.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = 'ICON_EXECUTE_OBJECT'
text = 'TEST2'
info = 'TEST2 INFO'
IMPORTING
result = icon_str
EXCEPTIONS
OTHERS = 0.

* place text and icon on button
b_test2 = icon_str.

No comments:

Post a Comment