cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a button that close a window/popup.

Former Member
0 Kudos

Hi, I must create in a view a button that close the window/popup that include the view, the button must be like the OK button of the popup or the X button at the top-right side . It's possible?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

in SE80 you have the webdynpro component wdr_test_window_suite,

there you should look for the main_close view, all you need to know

grtz

Koen

Answers (2)

Answers (2)

thomas_szcs
Active Contributor
0 Kudos

Hi Avalor,

Just as a side note, it's highly advised to use the built-in OK-button instead of creating your own. You can select between many different pre-configured button combinations, register your own action to them, replace the text or tooltip, etc.

One day we might add a help link to popups or other fancy features. We might improve look & feel, keyboard navigation (by adding short-cuts) or something else. If you stay within the borders of the original concept your application will benefit automatically. Moreover, your popups will integrate/blend-in seamlessly with those that are part of SAP delivered applications. The result will be lots of happy users who will truly appreciate that your application works as they expect.

Best regards,

Thomas

former_member196517
Contributor
0 Kudos

Hi Avalor,

if you are displaying any popup as modal dialog than you can use button_kind = if_wd_window=>co_buttons_close while creating a window, this will provide you a default close button to popup.

for example

CALL METHOD l_window_manager->create_window

EXPORTING

button_kind = if_wd_window=>co_buttons_close

modal = abap_true

window_name = 'USER_STATUS'

title = 'Anwenderstatus'

close_button = abap_false

RECEIVING

window = l_window.

Thanks

Anuj

Former Member
0 Kudos

I would create a custom button, not a standard.

Former Member
0 Kudos

Hi Avalor.

You can create a custom pop up window. Just create a view that contains all

elements that you want to display. Add the button that closes the view. Create a

new window that only contains this new view. Use the mentioned method to create

a new window as pop up. You just have to pass the name of the window you have

created. Store the reference to the new window in the component controller

(mr_window).

From the new window->view you have access to the component controller.

In the action handler of the button you can use something like this:

wd_comop_controler->mr_window->close( ).

Cheers,

Sascha

former_member196517
Contributor
0 Kudos

Also you have to create one event at called component controller and then at close button event you do this....

      • fire event (applications have to close the window)

DATA: l_ref_componentcontroller TYPE REF TO ig_componentcontroller.

l_ref_componentcontroller = wd_this->get_componentcontroller_ctr( ).

l_ref_componentcontroller->fire_return_to_appl_evt(

EXPORTING

status_changed = status_changed

).

ofcourse this event has to be a interface and should be mapped to calling component.

Anuj

Former Member
0 Kudos

Hi Avalor.

AFAIK windows/popups are always created in modal status which means you can

not click any button on the main view which created the popup.

But you can create an external window if you really want to do this process.

Using the window manager you can call the method

create_external_window whcih creates a non modal window per default and returns

a reference to the created window which you can store as view or component

controller attribute. When a user clicks the button you then could try to call ref_window->close( ).

Hope this helps.

Cheers,

Sascha

Former Member
0 Kudos

It doesn't work.

Former Member
0 Kudos

What does not work?

the close() method?

Former Member
0 Kudos

Yes the close( ) method.

Former Member
0 Kudos

What exactly happens?