cancel
Showing results for 
Search instead for 
Did you mean: 

Can Not Close Window with CLOSE_WINDOW Parameter

Former Member
0 Kudos

Hi All,

I am currently learning about closing window by using parameters of window exit plugs. Unfortunately, I still can't create a web dynpro application that can do this. Below are some screen shots of my web dynpro component definition:

The window outbound plug:

The view controller method that fires the plug:

When I tested my web dynpro application, it just redirected to www.google.com, but the window did not close. What is wrong with my web dynpro? I'm using SAP NetWeaver 2004s ABAP Trial Version.

Many thanks in advance.

Regards,

Haris

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi Haris Sahlan,

there are two scenario's to exit our application:

1.log-out(log-out and redirected to any URL like www.google.com)

2.exit(exit the application and close the window).

for 1st scenario :

create a LOGOUT button and action method .

create an exit plug with  parameter as www.google.com

same as above scenario and add URL parameter and goto action method of exit button ,write the below code :

data: l_ref_zak_wd_app2 type ref to ig_zak_wd_app2 .

l_ref_zak_wd_app2 =   wd_this->get_zak_wd_app2_ctr( ).

   l_ref_zak_wd_app2->fire_logoff_plg(

     url =    'http://www.google.com.com'                           " String

   ).

for 2nd scenario :

just create a outbound plug at window level and go to the method and call the outbound plug using code wizard .....

Ex: test app1

create an exit button ,

go to->window click on outbound plug-->give op plug name and select plug type as EXIT PLUG

go to->action method of that exit button and write the below or click on code wizard and call the the method start navigation.

data: l_ref_zak_wd_app2 type ref to ig_zak_wd_app2 .

l_ref_zak_wd_app2 =   wd_this->get_zak_wd_app2_ctr( ).

   l_ref_zak_wd_app2->fire_exit_plg(

   ).

NOTE : But if u try to create any outbound plug with URL parameter then definitely if will ask for url input parameter in firing URL parameter.

so , better if u are creating both URL and exit plugs.., first try to create exit plug for closing application activate and test it ...

then try to go for exit plug with URL parameter ... activate and test the application...

it will work sure ...

Former Member
0 Kudos

Hi Lokeswar,

Thanks for replying. What I was trying to do was closing my application window. My steps were just like my first post. I had to create the URL parameter on my exit plug since if I didn't, I'd receive an error message as follows:

The system asked for the URL parameter even though I never defined such parameter on my exit plug.

However, if I used the URL parameter, the window was not closed, but the page was redirected to the URL specified instead. It seemed the CLOSE_WINDOW parameter had no effect. Any suggestion?

Regards,

Haris

Former Member
0 Kudos

Hi ,

Please try the same above scenario by removing CLOSE_WINDOW URL parameter and fire the OUTBOUND Plug it will work ...

Otherwise if u need CLOSE_WINDOW URL parameter, then pass the input url parameter as

'CLOSE.HTM/<COMPONENT NAME>' instead of google.com URL..

please try this two scenario's definitely it will work,if any concerns please reply me.

Thanks and Regards,

Lokesh.

Former Member
0 Kudos

Hi Lokeswar,

I've tried this. If I don't define the URL parameter in the window outbound plug, then, when I run my web dynpro application, I'll receive an error. The system asks me to define the URL parameter anyway when I fire the outbound plug even though I never define such parameter. If I define the URL parameter in the window outbound plug, surely I'll have to specify a URL when I fire the outbound plug. If I specify the URL, the window will not close anyway.

Any other suggestion will be appreciated. Also, may I know what version of NetWeaver you are using?

Regards,

Haris

Former Member
0 Kudos

HI,

Please try the below process ...,

Remove both OUTBOUND plug and URL parameter, come out of the application.

then once again open the application and enter outbound plug newly and fire the outbound plug it will work ..

Thanks and Regards,

Lokesh.

Former Member
0 Kudos

Hi Lokeswar,

Many thanks for your another suggestion. I have tried your suggestion, but still no luck. Perhaps I didn't get what you said. Maybe you can point my mistake from the screen captures of the current condition my web dynpro component.

1. The window startup plug event handler:

2. The application parameter:

3. The window outbound plug:

4. The view layout:

5. The view's 'close window' action handler:

The result when I run my application and click the 'Close Window' button:

Definitions as can be seen on picture 1 to 5 are the only ones that don't trigger compile-time error. If I don't define the CLOSE_WINDOW parameter of the startup plug event handler method as can be seen in picture 1, I'll receive an error when trying to activate my web dynpro component.

Any other suggestions? Which part should I change now?

Regards,

Haris

Former Member
0 Kudos

Hi ,

I thnik u r not getting my point ...,

Please remove the CLOSE_WINDOW parameter as well as the code in action method , then  activate the application.

Then open the action method and fire the OUTBOUND plug and activate the method and application.

It will work sure ...

Thanks ,

Lokesh.

former_member199125
Active Contributor
0 Kudos

Haris,

When you fire the plug like above, you may not able to observe, it will close the webdynpro window and in the same google window will open.

For more clarification put some kind of code in window exit method then you wil get to know.

Regards

Srinivas    

Former Member
0 Kudos

Hi Srinivas,

Thanks for the reply. Apparently, if I didn't use the URL parameter, I received an error message that said the URL parameter must be specified. Therefore, I defined the URL parameter both on the exit plug and the UI action event handler. Any other suggestions?

Regards,

Haris

Former Member
0 Kudos

Hi,

if u enter URL parameter , definitely it will ask u to provide input URL ....,

so please remove URL and try it with firing OUTBOUND_PLUG..

it will work definitely ....

Thanks and Regards,

Lokesh.

Former Member
0 Kudos

Hi,

Go through this tutorial, it ll guide you close the window using close_window parameter.

http://webdynproabap.wordpress.com/2012/11/03/closing-a-web-browser/

Best regards,

Arun Krishnamoorthy

Former Member
0 Kudos

Hi,

The close_window parameter has to be given to the application parameter and not as parameter to outbound plug.

Best regards,

Arun Krishnamoorthy

Former Member
0 Kudos

Hi Arun,

Thank you for the reply. I have tried the tutorial as you suggested but now I receive an error message that says 'Parameters of exit plugs and suspend plugs must be of type STRING or TIHTTPNV '.

Below are my steps:

1. To be able to create an application parameter, firstly I created a parameter of the window's DEFAULT inbound plug method handler. The parameter name is CLOSE_WINDOW.

The rest of my steps are exactly like the tutorial.

2. After the step 1, now I can create the application parameter with the name 'CLOSE_WINDOW'.

3. I created a UI element with the action to close the window.

4. I created some outbound plugs with the type exit plug in the window.

5. I implemented the event handler of the UI element that closes the window. I just copied the code from the tutorial and pasted to my method.

Below is the code:

METHOD onactionexit_close.

  DATA lo_api_v_main TYPE REF TO if_wd_view_controller.

  lo_api_v_main = wd_this->wd_get_api( ).

  DATA lo_window TYPE REF TO if_wd_window_controller.

  CALL METHOD lo_api_v_main->get_embedding_window_ctlr

    RECEIVING

      result = lo_window.

  DATA :

    it_parameters TYPE wdr_event_parameter_list,

    wa_parameters LIKE LINE OF it_parameters,

    lv_data TYPE REF TO data.

  FIELD-SYMBOLS : <fs_para> TYPE ANY.

  CREATE DATA lv_data TYPE c.

  ASSIGN lv_data->* TO <fs_para>.

  <fs_para> = 'X'.

  wa_parameters-name = 'CLOSE_WINDOW'.

  wa_parameters-value = lv_data.

  INSERT wa_parameters INTO TABLE it_parameters.

  CLEAR wa_parameters.

  CALL METHOD lo_window->if_wd_view_controller~fire_plug

    EXPORTING

      PARAMETERS = it_parameters

      plug_name = 'EXIT_PLUG'.

ENDMETHOD.

Is there something wrong with my steps?

Regards,

Haris

Former Member
0 Kudos

Hi Haris,

You dont have to declare close_window parameter in the handledefault method and also try removing the two other exit plugs. Apart from that everything looks fine.

Refer the sap help link below

http://help.sap.com/saphelp_nw04s/helpdata/en/45/1bc575ba064574e10000000a114a6b/content.htm

Also note if you are using firefox this will not work.

Best Regards,

Arun Krishnamoorthy

Former Member
0 Kudos

Hi Arun,

If I didn't create the close_window parameter in the handledefault method, I couldn't create the application parameter with the same name. I kept receiving error that says "CLOSE_WINDOW is neither a predefined parameter nor a parameter of a starter plug".

So, in order to be able to create an application parameter, I have to define a parameter of the starter plug which also means to create a parameter of the starter plug event handler method. Don't you have to do the same thing when creating an application parameter or is it just me?

Regards,

Haris