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

passing icons at runtime to a pushbutton

Former Member
0 Likes
1,761

Hi,

I have a pushbutton to which i need to pass different icons at runtime...

eg:

. when i click on it some activity is performed and the icon in the button is also changed .

Can some one help me.

Hi,

I have a pushbutton to which i need to pass different icons at runtime...

eg:

. when i click on it some activity is performed and the icon in the button is also changed .

Can some one help me.

7 REPLIES 7
Read only

Former Member
0 Likes
1,206

Hi

U should insert the pushbuttons on different subscreens: in this u can decide which subscreen to be load in order to show a certain pushbutton.

Max

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,206

you must search the forum, this topic has been answered lots of times. And there are demos in your sap system (se38, environment, examples, abap)

Read only

Former Member
0 Likes
1,206

copy-paste from http://abaplovers.blogspot.com/2008/05/abap-game-tic-tac-toe.html

Edited by: Vijay Babu Dudla on Jan 31, 2009 4:02 AM

Read only

Former Member
0 Likes
1,206

Hi,

Did you want something like this

TABLES: sscrfields.
DATA: butt_sel.

SELECTION-SCREEN: PUSHBUTTON /2(10) but_sel USER-COMMAND test.


AT SELECTION-SCREEN.
  CASE sscrfields.
    WHEN 'TEST'.
      IF butt_sel EQ 0.
        butt_sel = 1.
        but_sel = '@0H@'.
      ELSE.
        butt_sel = 0.
        but_sel = '@0E@'.
      ENDIF.

 endcase.
INITIALIZATION.
  but_sel = '@0E@'.
  butt_sel = 0.

Regards

Read only

Former Member
0 Likes
1,206

Hi

In PAI during button click set a flag.

In PBO routine,

write a module that changes the screen display.

Within that check for flag value and modify.

PROCESS BEFORE OUTPUT.

MODULE STATUS_2700.

MODULE CHANGE_SCREEN. "module that changes the screen display

PROCESS AFTER INPUT.

MODULE USER_COMMAND_2700. "set flag value for the button

MODULE CHANGE_SCREEN OUTPUT. " enables and disables my tbl control " modify to change icon

CASE FLAG.

WHEN 1.

LOOP AT SCREEN.

IF SCREEN-NAME = 'B_ENA'.

SCREEN-INVISIBLE = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

LOOP AT SCREEN.

IF SCREEN-NAME = 'B_DIS'.

SCREEN-INVISIBLE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

WHEN 2.

LOOP AT SCREEN.

IF SCREEN-NAME = 'B_DIS'.

SCREEN-INVISIBLE = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

LOOP AT SCREEN.

IF SCREEN-NAME = 'B_ENA'.

SCREEN-INVISIBLE = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDCASE.

ENDMODULE. " CHANGE_SCREEN OUTPUT

Hope this helps

Regards,

Jayanthi.K

Read only

Former Member
0 Likes
1,206

Hi,

try this short example:



* DB-Tabellen und TYPE-POOLS
TYPE-POOLS: ICON.
*
SELECTION-SCREEN: SKIP.
SELECTION-SCREEN: BEGIN OF LINE.
SELECTION-SCREEN: PUSHBUTTON 30(30) PB01 USER-COMMAND FB01
                  VISIBLE LENGTH 15.
SELECTION-SCREEN: END   OF LINE.
*
DATA: PB01_INIT(80).
*
AT SELECTION-SCREEN.
*
* Button in Dynpro
  IF PB01 = PB01_INIT.
*
    CALL FUNCTION 'ICON_CREATE'
      EXPORTING
        NAME   = ICON_CANCEL
        TEXT   = 'Cancel'
        INFO   = 'Report cancel'
      IMPORTING
        RESULT = PB01
      EXCEPTIONS
        OTHERS = 0.
  ELSE.
    CALL FUNCTION 'ICON_CREATE'
      EXPORTING
        NAME   = ICON_EXECUTE_OBJECT
        TEXT   = 'Start'
        INFO   = 'Report ausführen'
      IMPORTING
        RESULT = PB01
      EXCEPTIONS
        OTHERS = 0.
  ENDIF.
*
INITIALIZATION.
* Button in Dynpro
  CALL FUNCTION 'ICON_CREATE'
    EXPORTING
      NAME   = ICON_EXECUTE_OBJECT
      TEXT   = 'Start'
      INFO   = 'Report ausführen'
    IMPORTING
      RESULT = PB01
    EXCEPTIONS
      OTHERS = 0.
*
  PB01_INIT = PB01.
*
************************************************************************
*
START-OF-SELECTION.
*
*
END-OF-SELECTION.
*
************************************************************************

regards, Dieter

Read only

Former Member
0 Likes
1,206

Hi,

Check out this demo program

DEMO_DYNPRO_STATUS_ICONS

Hope this helps.

Regards,

Deepthi.S