cancel
Showing results for 
Search instead for 
Did you mean: 

View triggers closing of its window on its own

Former Member
0 Kudos

Hi,

a modal window can be created and closed by the initiator. But how is it possible that a view which is embedded in a modal window can trigger closing of the modal window on its own? The scenario is that there are two components: first one for the main window, second one for the modal window. the second one shall close itself on its own.

Has somebody a tip / an idea?

Thanks and Regards,

Marcel

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hi Marcel,

This is possible. You can obtain the pointer of the window of the current view is part of in wdDoModifyView by calling view~IF_WD_VIEW_CONTROLLER->get_embedding_window( ). The pointer is of type IF_WD_WINDOW, which represents the current window. Then just called close( ).

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

before posting the thread I have tried something similiar in WDDOMODIFYVIEW but it dumps:

1: DATA: lo_window_controller TYPE REF TO if_wd_window_controller,

2: lo_window TYPE REF TO if_wd_window.

3: lo_window_controller = view->IF_WD_VIEW_CONTROLLER~get_embedding_window_Ctlr( ).

4: lo_window = lo_window_controller->get_window( ).

5: lo_window->close( ).

the 5th line dumps because lo_window is initial. I assume the method 'get_window' returns only an object if there is any popup, but the view is even the popup.

the difference is to your reply that I cannot find method 'IF_WD_VIEW_CONTROLLER->get_embedding_window' but 'IF_WD_VIEW_CONTROLLER~get_embedding_window_<u>Ctlr</u>'

Is it a bug?

Thanks and Regards,

Marcel

thomas_szcs
Active Contributor
0 Kudos

Hi Marcel,

Have you created the window using window_manager->create_window( ) by supplying the name of an actual window? It does not work if the outdated method of displaying a view as popup was used.

Best regards,

Thomas

0 Kudos

Hi Marcel,

the method 'get_embedding_window_ctlr' of IF_WD_VIEW_CONTROLLER returns the controller of the embedding window. The method 'get_window' of IF_WD_WINDOW_CONTROLLER will return the pointer to the popup, if the window is related to a popup.

If I understood it correctly, your example is as follows:

Component CA uses component CB. Component CA has a window WA that embedds interface view WB of component CB. Window WB embedds view VB of component CB. Window WA is opened as a popup.

The method 'get_embedding_window_ctlr' called in a method of view controller VB will return the window controller WB. WB is NOT related to a popup, therefore the method 'get_window' will return NULL. You could call 'get_embedding_window_ctlr' again for interface view WB. This would return the window controller WA, which is related to a popup: 'get_window' would return the reference to the popup then.

Nevertheless, I would suggest another approach:

Instead of embedding interface view WB in window WA and creating a popup for WA, I would directly create a popup for WB using the method 'create_window_for_cmp_usage'. You could then call 'get_embedding_window_ctlr' on VB and from there 'get_window' to get the window. You could also use the method WDDOONOPEN of WB. The importing parameter WINDOW_DESCR has an attribute WINDOW that points to the popup.

Best regards, Ariane.

Answers (0)