Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ICON_CREATE on button on a screen

Former Member
0 Likes
6,766

Dear expers,

I have a requirement to expand and collaspe a subscreen on click of a button. But i stuck in changing the icon of a button on every click. I have a example to change the icon of a button on selection screen but its not working on a screen with ICON_CREATE function.

Kindly suggest,

Praveen Lobo

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,256

Hi Praveen,

Though not clear about your requirement, every user action will trigger a PBO event in the dialog pool program. So, you can put the CREATE_ICON function module in PBO and it will be triggered every time the user action is executed. And hence once the screen is refreshed and reloaded, you will see the new ICON.

Let me know if you need more details.

Hope this helps.

Thanks,

Samantak.

Dear expers,

I have a requirement to expand and collaspe a subscreen on click of a button. But i stuck in changing the icon of a button on every click. I have a example to change the icon of a button on selection screen but its not working on a screen with ICON_CREATE function.

Kindly suggest,

Praveen Lobo

6 REPLIES 6
Read only

Former Member
0 Likes
3,257

Hi Praveen,

Though not clear about your requirement, every user action will trigger a PBO event in the dialog pool program. So, you can put the CREATE_ICON function module in PBO and it will be triggered every time the user action is executed. And hence once the screen is refreshed and reloaded, you will see the new ICON.

Let me know if you need more details.

Hope this helps.

Thanks,

Samantak.

Read only

0 Likes
3,256

Hello Samantak,

Thanks for the reply,

I understand to put coding in PBO event, but if i mention the pushbutton name on importing parameter of ICON_CREATE it will give error pushbutton not defined. So how can i link the icon text to a button on screen. Or do you have a sample code for the same.

Regards,

Praveen Lobo

Read only

0 Likes
3,256

Hi Praveen,

Have a look at the following Report : DEMO_DYNPRO_STATUS_ICONS. And also the SAP help Documentation

http://help.sap.com/saphelp_nw04/helpdata/en/59/348efa61c611d295750000e8353423/content.htm

Hope this will help.

Thanks,

Samantak.

Read only

0 Likes
3,256

Hello Samantak,

I already checked the examples u mentioned. These example are on textfields and not work on a pushbutton on a screen.

I am looking for a example of pushbutton icon change on a screen ( not on selection screen ).

Regards,

Praveen Lobo.

Read only

0 Likes
3,256

Hi,

The example Report Program explains you how to use the code for changing the ICON for a text. But in the function module documentation of the ICON_CREATE, it is clearly mentioned that the same can be used to change the ICON of the Push Button also.

Code Snippet:

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = icon_name

text = icon_text

info = 'Status'

add_stdinf = 'X'

IMPORTING

result = push_btn

EXCEPTIONS

icon_not_found = 1

outputfield_too_short = 2

OTHERS = 3.

push_btn should be the name of the Push button on the Screen. And change the property of it to Output enabled. And then execute the code. it will change the Icon of the Push button dynamically.

have a look at the following link:

http://help.sap.com/saphelp_nw70/helpdata/en/9f/dba9a635c111d1829f0000e829fbfe/content.htm

"Pushbuttons have a label - the text that you specify statically in the attributes - and can also have icons. If you set the Output field attribute for a pushbutton, you can also set its text dynamically in the ABAP program. To do this, you must create a field in the ABAP program with the same name as the pushbutton. You must then assign the required text to the field before the screen is displayed. You can also assign icons to dynamic texts on pushbuttons by including the icon code in the text. The icon codes are all contained in the include program <ICON>. For example, the ICON_CANCEL () icon has the code @0W@." - This explains that you can change the icon of the Push button.

Hope this helps.

Thanks,

Samantak.

Read only

Former Member
0 Likes
3,256

hello pravin,

i din get ur requirement clearly.but i got it up to some extent. here are some links whih will help you.

have look at following links.

1)

http://www.sapdesignguild.org/resources/icon_cookbook/icon_cookbook.pdf

2)

http://help.sap.com/saphelp_nw70/helpdata/EN/42/d5bfd93a0b1369e10000000a1553f7/content.htm

regards,

amol khairnar