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

Change Button text ?

Former Member
0 Likes
1,719

Hi All,

I got a button in my custom transaction in ABAP. I want to change the text/Label of the button dynamically based on some conditions. How to achieve the same.

Thanks & Regards,

Navneeth K.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,044

Hello,

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.

Cheers,

Vasanth

2 REPLIES 2
Read only

Former Member
0 Likes
1,045

Hello,

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.

Cheers,

Vasanth

Read only

Former Member
0 Likes
1,044

Data: gs_toolbar TYPE stb_button,

handle_toolbar

FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object e_interactive,

*----


  • METHOD to handle_toolbar

*----


METHOD handle_toolbar.

  • append a separator to normal toolbar

CLEAR gs_toolbar.

MOVE your text TO gs_toolbar-TEXT.

APPEND gs_toolbar TO e_object->mt_toolbar.

Try this.

Thanks & Regards,

Harsha.