cancel
Showing results for 
Search instead for 
Did you mean: 

Close a popup of another view being on the Main View

Former Member
0 Kudos

Dear Gurus,

I've requirement wherein, when the user clicks on add details a window is popped up on the same application and after the user fills up the details on that window, when he clicks on a button, say, 'SAVE', the window should get closed.

I'm calling this window from a different view.

I had a clear search on this requirement under SDN. Not able to find the exact solution. Even if it is there, I might have missed it, please do not mind.

Kindly requested to help me out on the same.

Regards,

-Syed.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Syed - If you used the wizard in order to create the popup the wizard create a button "OK" that I'm guessing you change to "SAVE", you will need to create an EVENT HANDLER under your method list tab in my example my EVENT HANDLER is "SEARCH_RESULT" once the user click the "OK" button it will call SEARH_RESULT event and it will do your code inside the event.


  DATA LO_WINDOW_MANAGER TYPE REF TO IF_WD_WINDOW_MANAGER.
  DATA LO_API_COMPONENT  TYPE REF TO IF_WD_COMPONENT.
  DATA LO_WINDOW         TYPE REF TO IF_WD_WINDOW.
  data LO_VIEW_C         type REF TO if_wd_view_controller.

  lo_view_c = WD_this->wd_get_api( ).

  LO_API_COMPONENT  = WD_COMP_CONTROLLER->WD_GET_API( ).
  LO_WINDOW_MANAGER = LO_API_COMPONENT->GET_WINDOW_MANAGER( ).
  LO_WINDOW         = LO_WINDOW_MANAGER->CREATE_WINDOW(
                     WINDOW_NAME            = 'SEARCH_POPUP_WIN'
  *                  title                  =
  *                  close_in_any_case      = abap_true
                     MESSAGE_DISPLAY_MODE   = IF_WD_WINDOW=>CO_MSG_DISPLAY_MODE_SELECTED
  *                  close_button           = abap_true
                     BUTTON_KIND            = IF_WD_WINDOW=>CO_BUTTONS_OK
                     MESSAGE_TYPE           = IF_WD_WINDOW=>CO_MSG_TYPE_NONE
                     DEFAULT_BUTTON         = IF_WD_WINDOW=>CO_BUTTON_OK
                     ).
lo_window->subscribe_to_button_event( button = IF_WD_WINDOW=>CO_BUTTON_OK
  action_name = 'SEARCH_RESULT'
  action_view = lo_view_c
  is_default_button = ABAP_true ).
*  lr_popup->open( ).
  LO_WINDOW->OPEN( ).

hope this help!!!!

Jason P-V

Former Member
0 Kudos

Hi Jason,

I've used the similar code to popup the window from the main window. Now, lets say, the window is opened and in that window there are certain fields to be filled up, and when the user fills the data and presses Save button, the data should get saved in the backend, and the popup should get closed, the similar way when we click on the Cross button of the window to hard close the window.

My requirement is this. I've also written some code under the event handler "Save". But not able to close the window.

Kindly requested to provided me the necessary class or method which is used to close the window.

Regards,

-Syed.

Former Member
0 Kudos

I suppose there are different ways of doing this, but I have used the following approach few times.

When you create the window, you can actually set it to your view (or component) controller (of the main component) like this:

wd_this->your_window = LO_WINDOW_MANAGER->CREATE_WINDOW

(Of course you need to define your_window attribute to your controller in order to use the above example.)

Then when you press the save button in your window component, you can raise an (interface) event, let's say SAVED (or whatever) after have the successfully saved your data to the DB. Then in your main component, you can have an event handler method listening this event. And in this method you can have code like this:

wd_this->your_window->close( ).

This way you can handle in your main component the closing of the window (similarly as you open the window).

Regards,

Karri

Former Member
0 Kudos

Syed - you need to call in your SAVE event handler the line of code that Karri just reply. so whenever the user click in the save button it will run your code (it will save in the database the inputs that the user enter and then it will close the window.


w_this->SEARCH_POPUP_WIN->close( ). 'SEARCH_POPUP_WIN is my window name'

in order to the main view display the result need to map the value of those inputs field (from the second view) to the context node that contain those values in the database, then you need to read it (using the wizard).

hope this help.

-Jason P-V

Former Member
0 Kudos

Thanks all. The problem is solved.

Regards,

-Syed.

Answers (0)