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

Change push button icon

MariaJooRocha
Contributor
0 Likes
1,944

Hi,

I've a push button on a screen with ICON_DATA_AREA_COLLAPSE icon name.

I pretend to change the name of the icon in run time (to ICON_DATA_AREA_EXPAND/COLLAPSE ), is it possibile? How?

I'm on 4.6c

Thanks in advance,

Maria João Rocha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,454

Hai Rocha,

This link gives you the details and a model code..

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

Regards,

Srikanth.

9 REPLIES 9
Read only

Former Member
0 Likes
1,454

Hi maria,

1. Not only the icon will change,

but also the whole screen

can collapse / expand

It works fantastic.

2. just copy paste this in new program.

REPORT abc.

INCLUDE icons.

DATA : iv TYPE i,

in TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETER : a(10) TYPE c MODIF ID m2.

PARAMETER : b(10) TYPE c MODIF ID m2.

PARAMETER : c(10) TYPE c MODIF ID m2.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

SELECTION-SCREEN PUSHBUTTON /1(4) p1 USER-COMMAND btn1.

SELECTION-SCREEN:

BEGIN OF LINE,

COMMENT 1(3) text-001 MODIF ID m1,

POSITION 8.

PARAMETERS:date10 LIKE rpctaxin-taxdt MODIF ID m1,

bank10(60) TYPE c MODIF ID m1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN:

BEGIN OF LINE,

COMMENT 1(3) text-001 MODIF ID m1,

POSITION 8.

PARAMETERS:date11 LIKE rpctaxin-taxdt MODIF ID m1,

bank11(60) TYPE c MODIF ID m1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b2.

*----


INITIALIZATION.

iv = 1.

in = 0.

AT SELECTION-SCREEN OUTPUT.

IF iv = 0.

WRITE icon_collapse AS ICON TO p1(4).

ENDIF.

IF iv = 1.

WRITE icon_expand AS ICON TO p1(4).

ENDIF.

LOOP AT SCREEN.

WRITE : screen-name , screen-group1.

IF screen-group1 = 'M1'.

screen-invisible = iv.

screen-input = in.

*SCREEN-INPUT = V.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

*----


AT SELECTION-SCREEN.

IF iv = 1.

iv = 0.

in = 1.

ELSE.

iv = 1.

in = 0.

ENDIF.

regards,

amit m.

Read only

Former Member
0 Likes
1,455

Hai Rocha,

This link gives you the details and a model code..

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

Regards,

Srikanth.

Read only

MariaJooRocha
Contributor
0 Likes
1,454

Thanks,

but i'm not using a selection-screen, i'm using a screen with several objects.

I know that i can do a loop, endloop, and change several fields of the screen, like screen-input, etc.

I'de like to change the icon of the button!

Best Regards,

Maria João Rocha

Read only

0 Likes
1,454

hello Maria,

if you are using the class cl_gui_toolbar for creating the buttons.

then you can change icon of the button using the method.

SET_BUTTON_INFO

regards,

kinshuk

Read only

0 Likes
1,454

Hi again,

1.

DATA : active_s01(50) TYPE c.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = 'ICON_CHECKED'

IMPORTING

RESULT = active_s01

EXCEPTIONS

OTHERS = 0.

<b>Move active_s01 to Myicon.</b>

(where myicon is on screen)

regards,

amit m.

Read only

0 Likes
1,454

thanks Amit Mittal for your ans.

it is more helpful to me

Read only

MariaJooRocha
Contributor
0 Likes
1,454

Thanks all,

Srikanth,

I've read the help, but i can't malke it work!

I've declared a variable with the same name of the button.

Can you please detail the steps to follow?

Example:

screen 100 - Button1

ABAP

Data: Button1(4) value '@xx@'. "Is it OK?

...?

Thanks,

Maria João Rocha

Read only

0 Likes
1,454

Hai Rocha,

At the initialization itself declare the variable,and then st selection screen, dynamically change the name accoding to the condition required............

yap what you tried is correct...

Regards,

Srikanth.

Read only

MariaJooRocha
Contributor
0 Likes
1,454

Thanks again.

Srikanth,

I haven't a selection-screen, but a normal screen.

But it works

According with the help, it worked!

Example:

screen 100

1 - Declare - Button1 (push button)

2 - Set the output field, at the element list

ABAP

Data: Button1(4) value '@xx@'. "xx corresponds to the pretended icon

PBO:

if ...

button1 = '@xx@'.

else.

button1 = '@yy@'.

endif.

Thanks,

Maria João Rocha