cancel
Showing results for 
Search instead for 
Did you mean: 

change Button text on the POP up message

Former Member
0 Kudos

Hi,

How to change Button text on the POP up message if I didn't used the button_kind.

I want to add 3 button : accept , Decline , Cancel button instead of Yes , no , cancel button.

If i am using function : create_popup_to_confirm.

thanks and regards

Amita Gandhi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

When you subscribe to the button events, there is an option to set the text button_text

DATA: l_cmp_api          TYPE REF TO if_wd_component,
        l_window_manager   TYPE REF TO if_wd_window_manager,
        l_popup            TYPE REF TO if_wd_window,
        l_text             TYPE string_table,
        l_api              TYPE REF TO if_wd_view_controller,
        message            TYPE string.

  l_cmp_api        = wd_comp_controller->wd_get_api( ).
  l_window_manager = l_cmp_api->get_window_manager( ).

  message = 'Do you want to approve ?'.
  APPEND message TO l_text.

  l_popup = l_window_manager->create_popup_to_confirm(
                text            = l_text
                button_kind     = if_wd_window=>co_buttons_ok
                message_type    = if_wd_window=>co_msg_type_information
                window_title    = 'Information'
                window_position = if_wd_window=>co_center ).

" subscribe to button event
DATA:  l_api TYPE REF TO if_wd_view_controller.
  l_api = wd_this->wd_get_api( ).

lo_window->subscribe_to_button_event(
               button            = if_wd_window=>co_button_ok
              button_text   = 'Accept'      " your button text
               action_name       = 'OK'
               action_view       = l_api
               is_default_button = abap_true ).

  l_popup->open( ).

Radhika.

aldo_buson
Explorer
0 Kudos

nice solution!

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Use the following code :

remember you need to create actions for every button with name (same as you have given for buttons text here you need to create actions with name : 'Click_one'...)

sothat you can go for further functionality .

data: l_cmp_api type ref to if_wd_component,

l_window_manager type ref to if_wd_window_manager,

l_popup type ref to if_wd_window,

l_text type string_table,

l_api type ref to if_wd_view_controller.

l_cmp_api = wd_comp_controller->wd_get_api( ).

l_window_manager = l_cmp_api->get_window_manager( ).

insert hello` into table l_text. "#EC *

insert `do you want to continue?` into table l_text. "#EC *

l_popup = l_window_manager->create_popup_to_confirm(

text = l_text

button_kind = if_wd_window=>co_buttons_yesnocancel

message_type = if_wd_window=>co_msg_type_question

window_title = 'Test: Popup to confirm'

window_position = if_wd_window=>co_center )."#EC *

l_api = wd_this->wd_get_api( ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_yes

action_name = 'Click_one'

action_view = l_api

is_default_button = abap_true ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_no

action_name = 'Click_Two''

action_view = l_api

is_default_button = abap_false ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_cancel

action_name = 'Click_Three'

action_view = l_api

is_default_button = abap_false ).

l_popup->open( ).

thanks,

Shaik Shadulla.