cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to close the main window

Former Member
0 Kudos

Hi experts,

I am trying to close the main window ( when WD application is executed the html page which displays should be closed ) if i press the exit button.

I have tried using different methods of if_wd_windowcontroller and window_manager none of them worked.

I have used the outbound plug in the window and type of this plug is EXIT. I am triggering this plug in the on action method of corresponding exit button.But output is not coming.

Please give inputs about this.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ravi,

This must solve your problem.Use the code in your button action.

wdr_task=>client_window->client->send_close_window( ).

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Direct access to WDR_TASK is not supported. This class in particluar has very low level access and can allow all kinds of situations which break the Web Dynpro Phase Model and framework.

http://help.sap.com/saphelp_nw70ehp2/helpdata/en/c4/b3670f72ff42eb8d4a508defd7f7a1/frameset.htm

Former Member
0 Kudos

Hi Thomas,

As you told direct access to WDR_TASK is not supported. We have been using this class to download

data to excel. So do you recommend any other way for downloading data.

Can you please brief me regarding the usage of this class?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Hi Thomas,

>

> As you told direct access to WDR_TASK is not supported. We have been using this class to download

> data to excel. So do you recommend any other way for downloading data.

>

> Can you please brief me regarding the usage of this class?

You should never need to use WDR_TASK to download data. Instead use the public API CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE.

http://help.sap.com/saphelp_nw70ehp2/helpdata/en/13/a1764299d76255e10000000a155106/frameset.htm

Former Member
0 Kudos

Hi Thomas,

Thanks for the info.

Former Member
0 Kudos

Hi srinivas,

Thnx for the reply.

If i paste the code in init method of component controller i am getting error 'Instance of Window W1 is already declared '. ( Here window name is W1 )

I pasted the code in other methods giving some null reference error.

Hi Thomas,

Any inputs from ur side ?

former_member199125
Active Contributor
0 Kudos

You said you need to close the current window when you click on your own button, in that button action you have to write the code.

Regards

Srinivas

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You should only attempt to close the main browser window with the CLOSE_WINDOW flag of an exit plug. There are some situations where this isn't allowed, but they are all documented in the online help.

http://help.sap.com/saphelp_nw70ehp2/helpdata/en/9b/65e04ea1ae4d9d8cfd329afa43e869/frameset.htm

Former Member
0 Kudos

HI,

Pass the CLOSE_WINDOW in parameter it will work.

Thanks

Karthik.R

nagarjun_kalletla
Participant
0 Kudos

Call the instance method Close of the If_wd_window .... This will automatically closes the Current Open Window.

Former Member
0 Kudos

Hi Nagarjun,

How to get the reference of the current open window to use the method CLOSE of if_wd_window.

I need to call close method with present open window instance.

former_member199125
Active Contributor
0 Kudos

try this,

DATA LO_WINDOW TYPE REF TO IF_WD_WINDOW.

DATA LO_WINDOW_controller TYPE REF TO IF_WD_WINDOW_controller.

DATA LO_VIEW_CONTROLLER TYPE REF TO IF_WD_VIEW_CONTROLLER.

LO_VIEW_CONTROLLER = WD_THIS->WD_GET_API( ).

lo_window_controller = LO_VIEW_CONTROLLER->GET_EMBEDDING_WINDOW_CTLR( ).

lo_window = lo_window_controller->get_window( ).

lo_window->close( ).

Regards

Srinivas

Edited by: sanasrinivas on Feb 29, 2012 3:41 PM

nagarjun_kalletla
Participant
0 Kudos

first you declare a Global attribute @ Component level lo_window type ref to if_wd_window.(mark it as public,interface)

data : win_comp type REF TO if_wd_component.

data : win_mng type ref to if_wd_window_manager.

data : win type REF TO if_wd_window.

win_comp = wd_comp_controller->wd_get_api( ).

CALL METHOD WIN_COMP->GET_WINDOW_MANAGER

RECEIVING

WINDOW_MANAGER = win_mng.

CALL METHOD WIN_MNG->CREATE_WINDOW

EXPORTING

WINDOW_NAME = 'WINDOW' 'here provide your window name

RECEIVING

WINDOW = wd_comp_controller->lo_window.

CALL METHOD wd_comp_controller->lo_window->OPEN.

______________________________________________________________________

Then in your Exit event <On action>

  • close the current window

wd_comp_controller->lo_window ->close( ).

This will definitely help you.....

Former Member
0 Kudos

Hi srinivas,

I have tried this before.It works only of you generate a window.

It is showing the error " Access through null object reference ".

former_member199125
Active Contributor
0 Kudos

in my code lo_window will refer to your current window.

Regards

Srinivas