cancel
Showing results for 
Search instead for 
Did you mean: 

how to close a window.. pls help

Former Member
0 Kudos

Hi friends,

I have a WD and on a button i m calling another webdynpr ona other browser.

I used --

cl_wd_utilities=>construct_wd_url(

EXPORTING

application_name = 'ZWDA4_TEST'

IMPORTING

out_absolute_url = url ).

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

lo_window = lo_window_manager->create_external_window(

url = url

lo_window->open( ).

But on Webdynpro2, i have a button, once this button is clicked i want to close this window..

can someone tell me how to code to close an existing window.. code pls..

thanks in advance,

Niraja

Accepted Solutions (0)

Answers (2)

Answers (2)

uday_gubbala2
Active Contributor
0 Kudos

Hi Niraja,

When you use the create_external_window to open your application in a new window it would be returning back the reference of this new window to you. So you will have to try figure out a way by which you can pass on this reference to your second component. (This reference passed back is of type CL_WDR_EXTERNAL_URL_WINDOW )Within the 2nd component you can just use the IF_WD_WINDOW~CLOSE method of CL_WDR_EXTERNAL_URL_WINDOW to close your 2nd application window. I couldnu2019t give it a try myself to make sure of this but just try doing it. I think that it should work for you.

Regards,

Uday

Former Member
0 Kudos

Hi Niraja,

You have two components i.e. let say P component is parent and C component is the called componet.

1) In your C component create an attribute lets say gv_window of type if_wd_window and keep it public.

2) In the C component only create an interface method with parameter of type if_wd_window. Now in the implementation of this method set the value of attribute gv_window created in step 1 to the value of parameter.

3) In the P component after opening the window, call this interface method of C component by passing the instance of window which you created.

4) Now in the C component on your button click while calling method to close the window pass the window instance as wd_comp_controller->gv_window.

And your work is done.

Regards,

Neha

Former Member
0 Kudos

Hi,

Please check this [blog.|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6687] [original link is broken] [original link is broken] [original link is broken];

I hope it can help you.

Regards,

$=====$

Are you newbie? Check this out: [Rules of Engagement|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]

Former Member
0 Kudos

hi J,

i want to close the wd2, which is been opened as a new browser, NOT the parent window.

i want to close the browser......

pls help..

Niraja

Former Member
0 Kudos

Hello Niraja,

When you have button, You would have created an event handler for that, if not created --> Create an action(ONACTIONCLOSE) for the button 'CLOSE'.

DATA: lo_window type ref to IF_WD_WINDOW.

lo_window must be global attribute and the reference variable which is used to open the window, same should be used to close the window.

Write this code in the ONACTIONCLOSE event handler.

lo_window->close( ).

then the window will be closed automatically.

Thanks,

Bharath.K

Former Member
0 Kudos

lo_window-open() im calling this in the action of the button of Webdynpro 1.

And i have abutton in webdynpro2 which shud close this window.

how come lo_window reference attribute will be availble in Webdynpro 2????

can u explain me pls...?

Niraja

Former Member
0 Kudos

Hi Niraja,

As i understand, you are opening the window which is located in the other WD component2 by calling from the WD component1.

IF this is right?

Then Create a Interface method in the WD2 and call this method from the WD1.

In the interface method(WD2), open the window and upon clicking close button using the same reference which is used to open the window, close the window.

The mistake u r doing here is, creating a global reference in the WD1 and opening the window from WD1 itself. so don't do that.

Create a global attribute in the WD2 and make a interaction between WD1 and WD2 through interface method.

Now, it should work..try?

Thanks,

Bharath.K

Former Member
0 Kudos

Bharat,

In PCUI there is a button, if that button is clicked im writing the code above i menteioend..

that code will trigger the WD in a new browser.

Now i m in WDynpro. i have a button here, once if i hit this button, the opened new browser shud close....

its NOT from one WD to another WD.. its from PCUI to WD(new browser)....

could u pls tell me..

Niraja

Former Member
0 Kudos

Hi,

What is the Reference of Lo_window?

Regards,

Xavier.P

Former Member
0 Kudos

left the project but changed the design thhoough