cancel
Showing results for 
Search instead for 
Did you mean: 

about the popup window created by if_wd_window_manager->create_window

Former Member
0 Kudos

hi,experts

i want to put out a pdf file in popup window.and use method create_windos of if_wd_window_manager to get it.then i find a question: i at least click twice to close the window....why? what modification i need to implement that the window close as soon as i click the "CLOSE" button once. i guess that is normal.

the original codes is as follows:

data: lr_view type ref to if_wd_view_controller,

lr_api_main type ref to if_wd_component,

lr_window_man type ref to if_wd_window_manager,

comp_usage type ref to if_wd_component_usage,

l_title type string value 'print the contract'.

lr_window type ref to if_wd_window.

lr_view = wd_this->wd_get_api( ).

lr_api_main = wd_comp_controller->wd_get_api( ).

lr_window_man = lr_api_main->get_window_manager( ).

  • l_title = wd_comp_controller->model->get_text( '006' ).

call method lr_window_man->create_window

exporting

modal = abap_true

window_name = 'POPUP'

title = l_title

close_button = abap_on

  • BUTTON_KIND = '1'

default_button = '5'

receiving

window = lr_window.

lr_window->open( ).

thanks..looking forwards to your help!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use the below code.

data: l_cmp_api type ref to if_wd_component,

l_window_manager type ref to if_wd_window_manager,

l_popup type ref to if_wd_window,

l_text type string_table,

l_api type ref to if_wd_view_controller.

l_cmp_api = wd_comp_controller->wd_get_api( ).

l_window_manager = l_cmp_api->get_window_manager( ).

insert `Data where changed` into table l_text.

insert `Do you want to save?` into table l_text.

l_popup = l_window_manager->create_popup_to_confirm(

text = l_text

button_kind = if_wd_window=>co_buttons_yesnocancel

message_type = if_wd_window=>co_msg_type_question

window_title = 'Test: Popup to confirm'

window_position = if_wd_window=>co_center ).

l_api = wd_this->wd_get_api( ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_yes

action_name = 'YES'

action_view = l_api

is_default_button = abap_true ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_no

action_name = 'NO'

action_view = l_api

is_default_button = abap_false ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_cancel

action_name = 'CANCEL'

action_view = l_api

is_default_button = abap_false ).

l_popup->open( ).

Hope this will help.

Regards

Shruti

shaik_sajid
Active Contributor
0 Kudos

hi Ping,

try both the options given below and let us know which one worked for you.

1.

data l_api_v_new_assignment type ref to if_wd_view_controller.
  l_api_v_new_assignment = wd_this->wd_get_api( ).
  data window_controller type ref to if_wd_window_controller.
  window_controller = l_api_v_new_assignment->get_embedding_window_ctlr( ).
  data window type ref to if_wd_window.
  window = window_controller->get_window( ).
  window->close( ).

2.

iF MO_POPUP TYPE REF TO IF_WD_WINDOW, IS AN ATRIBUTE DEFINED IN COMPONENT CONTROLLER
and in popup_method this is the coding related for opening popup .

DATA:lo_api TYPE REF TO if_wd_component,
lo_win_manager TYPE REF TO if_wd_window_manager,

lo_api = wd_this->wd_get_api( ).
lo_win_manager = lo_api->get_window_manager( )
wd_this->mo_popup = lo_win_manager->create_window(
title = 'xyz'
window_name = 'WINDOW NAME'
button_kind = if_wd_window=>co_buttons_okcancel
message_type = if_wd_window=>co_msg_type_warning ).

wd_comp_controller->mo_popup->open( ).

Then for closing pop up on event handler method of no write the following coding
wd_comp_controller->mo_popup->close( ).

Regards

Sajid

Former Member
0 Kudos

hi ,Sajid

1.

data l_api_v_new_assignment type ref to if_wd_view_controller.

l_api_v_new_assignment = wd_this->wd_get_api( ).

data window_controller type ref to if_wd_window_controller.

window_controller = l_api_v_new_assignment->get_embedding_window_ctlr( ).

data window type ref to if_wd_window.

window = window_controller->get_window( ).

window->close( ).

to your first option. my codes are written in a view of the main windows and the popup window is another, so can't get the exact window.. so there is a dump error after i test this one.

.

iF MO_POPUP TYPE REF TO IF_WD_WINDOW, IS AN ATRIBUTE DEFINED IN COMPONENT CONTROLLER

and in popup_method this is the coding related for opening popup .

DATA:lo_api TYPE REF TO if_wd_component,

lo_win_manager TYPE REF TO if_wd_window_manager,

lo_api = wd_this->wd_get_api( ).

lo_win_manager = lo_api->get_window_manager( )

wd_this->mo_popup = lo_win_manager->create_window(

title = 'xyz'

window_name = 'WINDOW NAME'

button_kind = if_wd_window=>co_buttons_okcancel

message_type = if_wd_window=>co_msg_type_warning ).

wd_comp_controller->mo_popup->open( ).

Then for closing pop up on event handler method of no write the following coding

wd_comp_controller->mo_popup->close( ).

to second one... i think this part of codes are the same as mine except the last sectence...... and i add the last sentence in my coding but nothing sepecial happend...

looking forward for more helps...thanks a lot