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

change button text dynamically

Former Member
0 Likes
14,737

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
harry_dietz
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi!

There is a simple way to do this:

1. Add a button with the screen painter and name it perhaps "HARRY".

2. In the properties set the button to "Output"

3. Create a variable in TOP or somewhere else which is also named "HARRY" perhaps by "DATA: HARRY(16) TYPE C."

4. Change HARRY to contain something by "HARRY = 'harry'." in the PAI.

Here is the sample coding

REPORT z_dietzha_test_000000000000085.

DATA: testbutton TYPE c, okcode TYPE syucomm.

CALL SCREEN 0100.

INCLUDE z_dietzha_test_00000000000085i.

***INCLUDE Z_DIETZHA_TEST_00000000000085I .

MODULE user_command_0100 INPUT.

IF sy-ucomm = 'EXIT'. LEAVE TO SCREEN 0. ENDIF.

IF testbutton = '1'. testbutton = '2'. ELSE. testbutton = '1'. ENDIF.

ENDMODULE.

And in the screen 0100 the TESTBUTTON has the field "Output" checked in the "General attr." tab.

Regards

Harry

Techouest_B
Explorer
0 Likes

It's Perfect,

and clear.