Skip to Content

Change push button icon

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 17, 2006 at 10:31 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 17, 2006 at 10:26 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 17, 2006 at 10:34 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 17, 2006 at 11:33 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

  • Posted on Mar 17, 2006 at 11:50 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.