cancel
Showing results for 
Search instead for 
Did you mean: 

Popup: button text does not change

Former Member
0 Kudos

Hello,

I display a popup. After pressing a popup button (the buttons at the buttom) I do the following in WDDOMODIFYVIEW:

if_wd_window~unsubscribe_from_button_event( button = if_wd_window=>co_button_cancel ).

if_wd_window~subscribe_to_button_event(button = if_wd_window=>co_button_cancel
                                       button_text = new_text
                                       ... )


if_wd_window~set_close_button( close_button = abap_false ).

The Problem is that the text of the button does not change and the close button does not disappear.

Best regards, Hergen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi hergen,

the problem is that........ whenever you call a pop up window from a view,

the pop up window will be displayed, but the 'WDDOMODIFYVIEW' method of the view will be run in the background. After clicking the button in the pop up, the same thing happens again. so you have to redefine your logic to make sure that the method is called at the appropriate time.

---regards,

alex b jsutin

Former Member
0 Kudos

Hi Alex,

I unfortunately don't understand your answer. Can you explain it in other words?

What do you mean by "run in background"?

The WDDOMODIFYVIEW method of the view is called and the button has successfully been subscribed to a new action (it works).

But why does the button text not change?

Thanks in advance and best regards, Hergen

Former Member
0 Kudos

hi hergen,

consider you are having a view 'a' and a popup window 'b'.

You click a button and the pop up window opens.

while it is opened.... the 'WDDOMODIFYVIEW' method will be called.

you complete the processing of the pop up window and click the ok button in it. so once again the 'WDDOMODIFYVIEW' method of view 'a' will be called.

so once again the text would be re initialized.

-


regards,

alex b justin

Answers (2)

Answers (2)

former_member196517
Contributor
0 Kudos

Hi Hergen,

whether you are doing this in WDOMODIFYVIEW of popup view or parent view... i hope it is pop up view only ?

Regards

Anuj Goyal

Former Member
0 Kudos

Hello,

thank you for your answers so far!

I would like to explain the issue in more detail:

1. The popup is being displayed.

2. I press a button which is at the buttom of the popup, that is, a roundtrip is started and within this roundtrip the WDDOMODIFYVIEW method is called.

In WDDOMODIFYVIEW I firstly unsubscribe und then subscribe the co_button_cancel to a different action und provide a new button text.

I could successfully test that the system executes the different action when pressing the button.

But why does the button text not change?

tina_yang
Explorer
0 Kudos

Hergen,

Try to put your code in the WDDOINIT() of the popup view instead of in WDDOMODIFYVIEW().

Regards,

Tina Yang

Former Member
0 Kudos

Hello Tina,

thank you, but this can't help because the popup is not re-called (after the button has been executed) and therefore WDDOINIT is not executed.

Best regards, Hergen

tina_yang
Explorer
0 Kudos

Hergen,

If I understood you correctly, you want to change the button text after you had the popup opened. I don't know if this is do-able. I will be very interesting to see if anyone was able to do this myself. My experience so far is that you can change the button text before the window has really appeared, ie:

-- from the parent view, subsribe the event with button text change, then open the window

-- from WDDOINIT() of the popup view

-- from WDDOMODIFYVIEW() of the popup view when the first_time is true

few things you might be able to try to see if you can get around this. First, in the action handling method, somehow to have your parent view to close and reopen the popup with the different button text. Or if you are able to find out how you can get hold of the buttons on the popupwindow then do dynamic programming in the WDDOMODIFYVIEW() of the popup view to change its text.

Good luck,

Tina Yang

former_member196517
Contributor
0 Kudos

Hi Hergen,

I am sorry i still can not inderstand the question :--

You have two wdomodifyviews rite one for parent view and one for popup view ?

Are you trying to change the text in wdomodifyview of parent view or popup view?

Regards

Anuj Goyal

Former Member
0 Kudos

Hello Tina, hello Anuj,

I am only refering to a popup which embeds one view. And I mean the WDDOMODIFYVIEW of that view.

The popup is displayed and has two buttons: OK and CANCEL.

After pressing the OK button I want so assign a different action and different text

to button CANCEL with SUBSCRIBE_TO_BUTTON_EVENT (in WDDOMODIFYVIEW). Please note that the popup is not closed in the meantime.

SUBSCRIBE_TO_BUTTON_EVENT is executed and I can see that indeed the new action is assigned to button CANCEL. But the text stays the same.

Former Member
0 Kudos

hi hergen...........

have an 'if' condition in the WDDOMODIFYVIEW of the current view such that...... when the pop up is opened set some flag to 'x' and then check that flag before assigining the button to the pop up. it works.......

--regards,

alex b justin

Former Member
0 Kudos

Hi Alex,

this is definitely not a solution to my problem

tina_yang
Explorer
0 Kudos

Hello, Hergen,

As I said in this thread earlier, I am not sure if you can change the button text once the window has appeared. You mentioned you can see the new actionis assigned to button CANCEL. Try this, add a if statement in the WDDOMODIFY method to check if first_time eq abap_true, assign a action, and if not, assign to another action, I don't think you will arrive to the other action.

If that is case, maybe you can tried to have the popup window closed and re-opened with the different button text.

Good luck,

Tina Yang

Former Member
0 Kudos

"It is currently not possible to change the text or the visibility of a standard popup button after the popup has been displayed for the first time."

tina_yang
Explorer
0 Kudos

Hergen,

Did you create this popup window with the button_kind you are interested in before you did all these unsubscribe and subscribe to the buttons?

The right sequence would be you use the if_wd_window_manager to create a popup/confirmation popup window, in that method call, you have to specify the botton_kind, and you will get a window with the type ref to if_wd_window back. You use this window ref to open the window and you need to save it so you can use it in the WDDOINIT of the view that are used for popup to do subscribe and unsubsribe button event.

DATA: lr_component_api TYPE REF TO if_wd_component.

DATA: lr_window_manager TYPE REF TO if_wd_window_manager.

DATA: lr_window TYPE REF TO if_wd_window.

lr_component_api = WD_COMP_CONTROLLER->wd_get_api( ).

lr_window_manager = lr_component_api->get_window_manager( ).

CALL METHOD lr_window_manager->CREATE_WINDOW

EXPORTING

  • MODAL = ABAP_TRUE

WINDOW_NAME = 'W_POPUP' "This is name of the interface view/window you want to pop

  • TITLE =

  • CLOSE_BUTTON = ABAP_TRUE

<b>BUTTON_KIND = if_wd_window=>co_buttons_okcancel </b> " or if_wd_window=>CO_BUTTONS_CLOSE, check if_wd_window to see your options

  • MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_NONE

  • CLOSE_IN_ANY_CASE = ABAP_TRUE

  • MESSAGE_DISPLAY_MODE =

  • DEFAULT_BUTTON =

RECEIVING

<b>WINDOW = lr_window</b>

.

now you can use lr_window to open the window

lr_window->open( ).

and if you save this lr_window on the component controller, you can access it again in the view that was embedded in the W_POPUP window.

I would suggest you to put the subsribe and unsubsribe the button event code in the WDDOINIT of the view.

Hope this helps, if you need more info on how to correctly subsribe to the buttons in your button_kind, let me know.

Regards,

Tina Yang