on 12-10-2008 9:44 AM
i have a pop-up window with one button , after preesing the button the window sholud close .
Thanks,
Shaik Shadulla.
closed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shaik,
here is very simple way of closing popup if u have a button on that popup say OK.
so in the event of that button.
u have to make a refernce to controoler class, and window.
l_window type ref to IF_WD_WINDOW_CONTROLLER,
l_popup type ref to if_wd_window.
l_popup = IF_WD_WINDOW_CONTROLLER->get_window( ).
and then
l_popup->close( ).
it is the easiest way to close a popup if u have a button.
if it worked for you. give points accordingly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello shaik shadulla,
When you have button, You would have created an event handler for that, if not created --> Create an action(ONACTIONCLOSE) for the button 'CLOSE'.
Create a global attribute: popup in the component controller
Attribute public Ref To Associated Type
popup Yes Yes IF_WD_WINDOW
Write this code in the ONACTIONCLOSE event handler.
wd_comp_controller->popup->close( ).
then the popup will be closed automatically.
Thanks,
Bharath.K
Edited by: Bharath Komarapalem on Dec 10, 2008 4:33 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shaik,
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,
[https://forums.sdn.sap.com/click.jspa?searchID=19749532&messageID=6190209]
[https://forums.sdn.sap.com/click.jspa?searchID=19749532&messageID=6190962]
Edited by: Neha Thukral on Dec 10, 2008 11:14 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.