cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

change button text dynamically

Former Member
0 Likes
14,735

hi,

Situation:

I have a 2 Buttons on a dynpro, which are labelled <i>start</i> and <i>stop</i>.

Aim:

The aim is to have only one button, which changes the label when pushed.

Question:

is there a way to change the text on a button (on a dynpro) dynamically? (I don't talk about GUI-Status Buttons).

Regards,

Matthias

View Entire Topic
Former Member

Hi,

Declare a global variable in TOP include as gv_pb_text(20). And then have one push button in the screen with name gv_pb_text and then mark it as Output only.

In your PBO, fill gv_pb_text based on your conditions,

IF gv_button_clicked EQ 'X'.

gv_pb_text = 'Start'(001).

ELSE.

gv_pb_text = 'Stop'(002).

ENDIF.

In your USER_COMMAND Module in PAI (or whatever your Fcode handling module is),

WHEN 'STARTSTOP'. "Assuming this pb's function code

IF gv_button_clicked EQ 'X'.

CLEAR gv_button_clicked.

ELSE.

gv_button_clicked = 'X'.

ENDIF.

Hope this helps..

Sri

Message was edited by: Srikanth Pinnamaneni