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

change button text dynamically

Former Member
0 Likes
14,742

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
0 Likes

Mattias,

It can be done!!!!

I am assuming u have screen 100.

Intially the text will be 'START' in the button and when u press that button, It should change to STOP???

Idea:

1. Create only ONE Button in the Screen 100.

2. Name the button as BUTTONNAME and assign a FCODe

as 'PRES'.

3. In the main program, have

data: buttonName(20).

4. Have a FLag

data: clicked type c value 'N'.

5. In the PBO.

If clicked eq 'N'.

buttonName = 'START'.

else.

buttonName = 'STOP'.

endif.

6. In the PAI.

case okCode.

when 'PRES'.

clicked = 'Y'.

.............

when others.

leave program.

endcase.

This could help and it is not a good programming practice. Instead , have a Second Screen 200(just a copy of Screen 100). When u press START in screen 100, get the okCode and call Screen 200(having STOP Button). When the User press STOP in Screen 200, u could Stop the transaction or leave the program.

Thanks

Kam

Note: Allot points for all worthful postings