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

change button text dynamically

Former Member
0 Likes
14,739

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

JUST CREATE TWO BUTTONS.

1. START

2. STOP

NOW..

wriite a module <b>loop_screen</b> at pbo. here you set one button visible, another invisible, depending o condiion.

i am just giving you one report program..where the selection screen get changed dynamically.

you can use the code of the <b>modify_screen</b> perform in your <b>loop_screen</b> module

run this code..and select radio buttons, see the screen change

for better understanding..just create 3 text-element, before running this code.

text-100 = COPY

text-200 = MOVE

text-300 = DELEET

report zxx.

-parameters----


selection-screen:

Begin of block r1 with frame title text-006.

parameters:

p_cp1 radiobutton group rb1 default 'X' USER-COMMAND RND,

  • p_cp2 radiobutton group rb1,

p_mv1 radiobutton group rb1,

  • p_mv2 radiobutton group rb1,

p_ren radiobutton group rb1,

p_del1 radiobutton group rb1.

  • p_del2 radiobutton group rb1.

selection-screen:

End of block r1.

selection-screen:

begin of block b1 with frame title text-004.

parameters:

loc1(128) obligatory lower case "Location1

default 'E:\usr\sap\put' modif id 1,

file(128) obligatory lower case "Filename

default 'E:\usr\sap\put\ekpo.dat' modif id 2,

newname(128) obligatory lower case "Filname

default 'abcd.txt' modif id 3,

loc2(128) obligatory lower case "Location2

default 'E:\usr\sap\D12\SYS\gen' modif id 4.

selection-screen:

skip,

PUSHBUTTON /05(23) TEXT-001 USER-COMMAND ZCOPY modif id 5,"COPY

PUSHBUTTON 30(23) TEXT-002 USER-COMMAND ZMOV modif id 6, "CUT

PUSHBUTTON 55(23) TEXT-003 USER-COMMAND ZDELETE modif id 7, "DELTE

skip,

PUSHBUTTON /30(23) TEXT-005 USER-COMMAND ZREN modif id 8, "RENAME

end of block b1.

*

at selection-screen output .

perform modify_screen.

&----


*& Form modify_screen

&----


form modify_screen.

loop at screen.

if p_cp1 eq 'X'.

if screen-group1 = '3' or

screen-group1 = '6' or

screen-group1 = '7' or

screen-group1 = '8'.

screen-active = 0.

endif.

elseif p_mv1 eq 'X'.

if screen-group1 = '3' or

screen-group1 = '5' or

screen-group1 = '7' or

screen-group1 = '8'.

screen-active = 0.

endif.

elseif p_del1 eq 'X'.

if screen-group1 = '3' or

screen-group1 = '4' or

screen-group1 = '5' or

screen-group1 = '6' or

screen-group1 = '8'.

screen-active = 0.

endif.

elseif p_ren eq 'X'.

if screen-group1 = '4' or

screen-group1 = '5' or

screen-group1 = '6' or

screen-group1 = '7'.

screen-active = 0.

endif.

endif.

modify screen.

endloop.

endform. " modify_screen

plz reward points if it helps you.

Former Member
0 Likes

Hi Anid again,

right now I am using 2 buttons, which in fact i show/hide during pbo loop at screen.

The problem with this is, that i can't place the buttons in the same place (same screen coordinates).

btw, i am on a dynpro in the layout-mode of screen painter, where I set up the butts.

If I can use 2 butts lying above each other or manipulate the label, when using only one, I shall be close to perfect.

matthias kasig

Former Member
0 Likes

Ya.i can understand the problem

but you can't put one object (here BUTTON) over another in screen painter.

visible/invisible is the solution as per my idea.

one cumbersome method is..(funny, stil it works)

1. just keep one button in that screen(100 say)

2.create a duplicate screen 200 with one button, the lable being different.

3.now call appropriate screen depending on condition, for better look and feel.

cheers