on 05-25-2009 3:24 PM
Hi,
I have to close the external window which is called as a pop-up window.
code for it is
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.
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 = 'SECOND'
title = 'SECOND'
close_in_any_case = abap_false
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->open( ).
Now through enhancement I have to close it
Kindly provide me solution for the same
For closing I was using the code
Closing a pop up window
data:
l_api type ref to if_wd_view_controller,
l_window_ctlr type ref to if_wd_window_controller,
l_popup type ref to if_wd_window.
l_api = wd_this->wd_get_api( ).
l_window_ctlr = l_api->get_embedding_window_ctlr( ).
if l_window_ctlr is bound.
l_popup = l_window_ctlr->get_window( ).
l_popup->close( 'l_popup' ).
endif.
But its giving me null pointer exception
Can anyone help me???????
hi,
have you tried save the lo_window to your component controller's one attribute? when you need to close the window, just call wd_comp_controller->second_window->close( )?
Edited by: huaizhi lee on May 28, 2009 9:59 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi experts,
I have to close the external window which is used as a pop-up window.
condition is like this...
I have two windows W1 W2.
Now from W1, I am calling W2 as a pop up window.
I have to close W2 through enhancement of W1.
Plz suggest...
Regards
Reeha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Reeha,
Go through this [excellent blog by Anzy|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6707] [original link is broken] [original link is broken] [original link is broken]; where he explains how you can close popup windows. (The blog is titled as external windows but it does actually refer to popup windows.)
Below is another workaround for the same. You must be callinng a popup by using the code wizard. Within this code at 1 place you would have something like lo_window_manager->create_window( ) which would be returning the reference to this popup window. You can create an attribute of type ref to IF_WD_WINDOW & ave this reference into it. So map this context node even to your popups view. When you want to close this popup just read the context attribute value in your view and call the close( ) method on this reference variable.
Just go through the code snippets below:
To call the popup and save the window reference into a component controller level attribute:
METHOD onactiondisplay_popup .
DATA: lv_node TYPE REF TO if_wd_context_node,
lv_kunnr TYPE ig_componentcontroller=>element_kna1-kunnr,
lt_vbak TYPE ig_componentcontroller=>elements_vbak.
* get message manager
DATA lo_api_controller TYPE REF TO if_wd_controller.
DATA lo_message_manager TYPE REF TO if_wd_message_manager.
lo_api_controller ?= wd_this->wd_get_api( ).
CALL METHOD lo_api_controller->get_message_manager
RECEIVING
message_manager = lo_message_manager.
lv_node = wd_context->get_child_node( name = 'KNA1' ).
CALL METHOD lv_node->get_attribute
EXPORTING
name = 'KUNNR'
IMPORTING
value = lv_kunnr.
SELECT * FROM vbak INTO TABLE lt_vbak WHERE kunnr = lv_kunnr.
" If no sales orders exist for the customer then display an error message quoting the same
IF sy-subrc NE 0.
* report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = 'No sales orders exist for this customer!'.
" If sales orders exist for the customer then display the orders within a popup
ELSE.
lv_node = wd_context->get_child_node( name = 'VBAK' ).
lv_node->bind_table( new_items = lt_vbak ).
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.
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 = 'POPUP_WINDOW'
title = 'Working with modal windows in webdynpro!'
CLOSE_IN_ANY_CASE = ABAP_TRUE ).
lv_node = wd_context->get_child_node( name = 'WINDOW_REFERENCE' ).
CALL METHOD lv_node->set_attribute
EXPORTING
value = lo_window
name = 'REFERENCE'.
lo_window->open( ).
ENDIF.
ENDMETHOD. "onactiondisplay_popup
To close the popup window:
lv_node = wd_context->get_child_node( name = 'WINDOW_REFERENCE' ).
CALL METHOD lv_node->get_attribute
EXPORTING
name = 'REFERENCE'
IMPORTING
value = lv_pop_window_ref.
lv_pop_window_ref->close( ).
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Have you tried using the hook method WDDOEXIT where the window can be closed.
DATA:
l_api TYPE REF TO if_wd_view_controller,
l_window_ctlr TYPE REF TO if_wd_window_controller,
l_popup TYPE REF TO if_wd_window.
l_api = wd_this->wd_get_api( ).
l_window_ctlr = l_api->get_embedding_window_ctlr( ).
IF l_window_ctlr IS BOUND.
l_popup = l_window_ctlr->get_window( ).
IF l_popup IS BOUND.
** CLOSE POPUP
wd_comp_controller->gref_msg_manager->clear_messages( including_permanent_msg = abap_true ).
l_popup->close( 'DELETE' ).
ENDIF. " IF l_popup IS BOUND
ENDIF. " IF l_window_ctlr IS BOUND
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.