cancel
Showing results for 
Search instead for 
Did you mean: 

Close the External Opend window on click of button

prathamesh_gandhi
Participant
0 Kudos

Hi All,

I have a parent window (A) and there is a button on click of that i am opening a another window as external window(B). Now on window B there is a button CLOSE and on that i want to close that external window. How can i achieve this?? i tried it using exit plug but i m not able to get the currently open windows URL.

Thanks In Advance.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

you use this thread this will clear your doubts its of same scenario

[http://forums.sdn.sap.com/thread.jspa?threadID=1434757]

http://forums.sdn.sap.com/message.jspa?messageID=9006554#9006554

Thanks and Regards,

Dhaya.G.

Edited by: Dhayalinie Ganesh on Feb 24, 2012 12:29 PM

prathamesh_gandhi
Participant
0 Kudos

HI Dhayalinie Ganesh,

Thanx for your quick reply but i have refer the 2 link that you have provided i have also implement it using the exit plug. but the issue is when this event triggers then a windows popup comes for confirmation something like "You are about to leave the secure page" if i click on yes it works fine but if i click on no then the browse window becames white.

Thanks in Advance.

Former Member
0 Kudos

Hi,

You can refer this forum which will help you,

http://forums.sdn.sap.com/message.jspa?messageID=9006554#9006554

Thanks and Regards,

Dhaya.G

Former Member
0 Kudos

Hi,

you write this code for closing the secondarty window on click of button

<window object>.destoyInstance();

Thanks and regards,

Dhaya.G.

Edited by: Dhayalinie Ganesh on Feb 24, 2012 11:41 AM

prathamesh_gandhi
Participant
0 Kudos

Hi ,

Will you please give me the declaration of the <window.object> & how can i get the instance.

Thanks in advance

ajoy_chakraborty
Participant
0 Kudos

Please check:

http://forums.sdn.sap.com/thread.jspa?threadID=1665958

*-SORRY- this link pertains to WD Java..but, you can have a look to get an idea

Edited by: Ajoy Chakraborty on Feb 24, 2012 4:43 PM

prathamesh_gandhi
Participant
0 Kudos

Hi Ajoy,

the link you have provided seems to be related to webdynpro java. i want it to be done in webdynpro abap.

Thanks In advance

Former Member
0 Kudos

Hi,

As source window and External window are running on two different sessions.You cannot close the external window from your source window.As they lost their communication.

Thanks and regards,

Dhaya.G.

Edited by: Dhayalinie Ganesh on Feb 24, 2012 10:53 AM

prathamesh_gandhi
Participant
0 Kudos

Hi Dhayalinie Ganesh,

I am not trying to close the external window from main window. instead i m having a button "CLOSE" on external window and on click of that window i want to close that externally opened window.

Thanks

ajoy_chakraborty
Participant
0 Kudos

Hi Prathamesh,

I am not clear about your requirement - are you trying to use URL through EXTERNAL WINDOW or you are trying to use WNDOW EXIT?

If its URL through External Window: following code might help--



METHOD onactiongo.

**-Created two radio buttons- SAP and Google. Select a radio button and click on GO button. Will redirect to the required URL

  DATA lo_nd_select_option TYPE REF TO if_wd_context_node.
  DATA lo_el_select_option TYPE REF TO if_wd_context_element.
  DATA ls_select_option TYPE wd_this->element_select_option.
  DATA lv_link TYPE wd_this->element_select_option-link.

* navigate from <CONTEXT> to <SELECT_OPTION> via lead selection
  lo_nd_select_option = wd_context->get_child_node( name = wd_this->wdctx_select_option ).

* get element via lead selection
  lo_el_select_option = lo_nd_select_option->get_element( ).

* @TODO handle not set lead selection
  IF lo_el_select_option IS INITIAL.
  ENDIF.

* get single attribute
  lo_el_select_option->get_attribute(
    EXPORTING
      name =  `LINK`
    IMPORTING
      value = lv_link ).


  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( ).

  CASE lv_link.
    WHEN 'SAP'.
      lo_window = lo_window_manager->create_external_window(
                  'http://sdn.sap.com').
      lo_window->open( ).

    WHEN 'GOOGLE'.
      lo_window = lo_window_manager->create_external_window( 'http://www.google.com' ).
      lo_window->open( ).
  ENDCASE.

ENDMETHOD.

If its WINDOW EXIT:

1) Create EXIT button in VIEW.

2) Go to WINDOWS -> Outbound Plug -> Give Plug Name (e.g: OUT_EXIT) -> Check INTERFACE -> Plug Type = EXIT.

In same window, in "IMPORTING PARAMETER FROM OUT_EXT" -> Parameter = URL -> Associated Type = String

3) Go to VIEW -> Properties -> Create Controller Usaged

4) In "onAction event" of EXIT button, write the following code:



DATA lo_window1 TYPE REF TO ig_window1 .

  lo_window1 =   wd_this->get_window1_ctr( ).

  lo_window1->fire_out_exit_plg( url = 'http://www.google.co.in' )

prathamesh_gandhi
Participant
0 Kudos

HI Ajoy,

DATA lo_window1 TYPE REF TO ig_window1 .

lo_window1 = wd_this->get_window1_ctr( ).

lo_window1->fire_out_exit_plg( url = 'http://www.google.co.in' )

i m using the same code but my problem is that my URL is dynamic, so that i cant hardcode the URL.

I want to know how can i get the URL of currently browsed window.

Thanks In Advance

former_member211591
Contributor
0 Kudos

Hi,

is it a popup?

prathamesh_gandhi
Participant
0 Kudos

Hi ,

Its not popup. i have open it as external window by creating a URL with some parameter and my URL is dynamically changes.

Thanks In Advance.