cancel
Showing results for 
Search instead for 
Did you mean: 

Preventing a pop-up from closing

former_member194198
Active Participant
0 Kudos

Hi All,

I've written a pop-up with an input box. I'd like to prevent the pop-up from closing if the user hasn't entered anything in the input box.

I open the popup from one view via the code:

DATA: l_cmp_api TYPE REF TO if_wd_component,

l_window_manager TYPE REF TO if_wd_window_manager.

l_cmp_api = wd_comp_controller->wd_get_api( ).

l_window_manager = l_cmp_api->get_window_manager( ).

IF wd_this->m_add_popup IS INITIAL.

wd_this->m_add_popup = l_window_manager->create_window(

window_name = 'ADDWINDOW'

button_kind = if_wd_window=>co_buttons_okcancel

message_type = if_wd_window=>co_msg_type_information ).

ENDIF.

lo_api = wd_this->wd_get_api( ).

wd_this->m_add_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_ok

action_name = 'OK'

action_view = lo_api

is_default_button = abap_true ).

wd_this->m_add_popup->open( ).

I have tried putting validation in the WDDOBEFOREACTION method in the ADDVIEW.E.g.

l_current_controller ?= wd_this->wd_get_api( ).

CALL METHOD l_current_controller->get_message_manager

RECEIVING

message_manager = l_message_manager.

.

CALL METHOD l_message_manager->report_fatal_error_message

EXPORTING

message_text = 'Error - Please enter a quantity and date'.

exit.

If I write out a message via the message manager, it appears in the calling view, not the popup. Regardless of what I do, the pop-up always seems to close.

Can you help?

Cheers

Richard

Accepted Solutions (1)

Accepted Solutions (1)

rainer_liebisch
Contributor
0 Kudos

Hello Richard,

you have to set:


window  type ref to if_wd_window.
wd_this->window->set_close_in_any_case( abap_false ).

where you open the popup window.

Now the popup only closes when you call the close method of IF_WD_WINDOW. So you can make your validation and close the popup window only when the entries are ok.

Regards,

Rainer

Answers (0)