‎2007 Sep 13 12:34 PM
Hi,
I've designed a Dynpro with some buttons whose icon has to change dynamically. For example, if a process goes ok it should be ICON_OKAY, or if it goes ko, ICON_CANCEL.
Does anyone know how to do this?
Thanks!
Carles
‎2007 Sep 13 12:38 PM
hi,
Check the FM 'ICON_CREATE', maybe it could be useful.
regards
‎2007 Sep 13 12:38 PM
hi,
Check the FM 'ICON_CREATE', maybe it could be useful.
regards
‎2007 Sep 13 12:42 PM
Hello Carles,
Please refer the standard code "DEMO_DYNPRO_STATUS_ICONS" in se38
on click of a button it is changing the status
here..in your case..with the click of different buttons we get different sy-ucomms
and based on value of sy-ucomm we can change the icon
Simple steps
***********************
When 'OK'.
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = 'ICON_OKAY' "name of icon u want
text = 'ok' "text of the icon
info = 'Status' "tool -tip text
add_stdinf = 'X'
IMPORTING
result = status_icon
EXCEPTIONS
icon_not_found = 1
outputfield_too_short = 2
OTHERS = 3.
when 'CANCEL'
CALL FUNCTION 'ICON_CREATE'
EXPORTING
name = 'ICON_CANCEL' "name of icon u want
text = 'cancel' "text of the icon
info = 'Status' "tool -tip text
add_stdinf = 'X'
IMPORTING
result = status_icon
EXCEPTIONS
icon_not_found = 1
outputfield_too_short = 2
OTHERS = 3.
endcase.
Similarly for others ..we can change the icon based on function code recieved
sy-subrc = 0.
"success
sy-subrc = 1.
Icon does not exist
sy-subrc = 2.
Icon and text do not fit on screen
sy-subrc = 3.
Error displaying status icon
<b><REMOVED BY MODERATOR></b>
Regards
Byju
Message was edited by:
Alvaro Tejada Galindo
‎2007 Sep 13 12:51 PM
HI,
in the screen painter go to the attributes of that push button.select the check box <b>WITH ICON</b> and
in the lower tab strip(program tab)
select the check box <b>OUTPUT FIELD</b>.
now in the pbo of the screen write like below.
data:<button name>(30).
data:but_name(30).
concatenate <icon_name> <icon text> into but_name sepatared by space.
<button name> = but_name.
rgds,
bharat.