Close external window using Button

Hi all,
I have implemented a Web Dynpro application which runs in a portal. It opens in a separate browser window.
Now I have to implement a "close" functionality inside this application, which closes the window when the user clicks on a Button (or LinkToUrl -- never mind).
What would be the best way to implement this on NetWeaver 2004s?
Regards,
Martin

HI,
You can use an external html file to close window.
Looks like your trying to close window from that window itself.
then create an close.html file and put it into mimes folder
access this file
String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"close.html");
wdThis.wdGetViewController().wdFirePlugExit(url);
in close.html write a javascript which contains following function
<html>
<SCRPT LANGUAGE='JavaScript'>
function win_close()
window.parent.opener = top;
window.parent.close();
window.opener.close();
</SCRPT>
<body onlod='javascript:win_close()'>
</body>
</html>

Similar Messages

  • Close a window using a button

    Hi,
    How do i close a window using a button in that window.
    I thought i might be able to add a windowListener to that button but that doesnt seem to work, any ideas?
    Thanks
    Cath

    eg
    http://www.geocities.com/rmlchan/tst.html

  • Close External Window in Web Dynpro Application

    Hi Folks,
    I am working on a development in Web Dynpro and I am pretty new to this topic, so I seek your help.
    The scene is:
    I have created a Web Dynpro application in which I open an URL using CREATE_EXTERNAL_WINDOW method of the Window Controller. I am able to open the window but not able to close it.
    I tried using methods,
    CLOSE()
      and
      SET_CLOSE_IN_ANY_CASE()
      but no success.
    Please guide me if anything more needs to be done for closing the opened window.
    Thank you.
    Sud.

    Thank you Thomas,
    You correctly pointed out, I was trying to close the external window from my source window.
    More precisely, I have a WD application which has a button (Search) on one of its views. On click of 'Search' button, I open a new window using 'CREATE_EXTERNAL_WINDOW' passing the URL 'www.google.com'.
    Till this point its fine, but now I want to close this newly opened window. As you said now these are 2 different sessions and cannot communicate anymore, so any guidance how to close this new window?.
    OR
    Is this the only way to call an URL i.e using CREATE_EXTERNAL_WINDOW? Is there any other way to call an URL without closing my current running WD application?
    Request your  help......
    Thanks.
    Regards,
    Sud....

  • How to Close external window?

    Hi Experts,
    1) For one of the development requirements, I am required to open my application in
    external window. For the same, I have changed the property of the iView  and page to
    launch the iView in an external window and not to display in content area. Now, I am
    able to display the application in a new window as per the requirement.
    Now, I want to close this window from a button event on the screen, but can't find a way to close it.
    If anyone's having an idea over it, that will be greatly appreciated???
    2) Also, in another application, I am downloading data into excel sheet and the download
    opens in a new window. Once the user clicks on the option (SAVE, OPEN, CLOSE),
    the blank window should close which works well in IE 7 but in IE 6 the user says the blank
    window is visible and they have to close it manually.
    I am using the following code for this:
    excelCSVFile = new FileInputStream(f);
    IWDCachedWebResource cachedWebResource = null;
    if (excelCSVFile!= null)
    cachedWebResource = WDWebResource.getWebResource
    excelCSVFile, WDWebResourceType.getWebResourceType(
    "xls","application/ms-excel"));
    cachedWebResource.setResourceName(fileName);
    wdContext.currentVn_XL_SheetElement().setVa_Resource(cachedWebResource.getURL());
    workbook.close();
    * BEGIN: Open new window: download button
    IWDWindow win =  wdThis.wdGetAPI().getComponent().getWindowManager().createExternalWindow
    (cachedWebResource.getAbsoluteURL(),"Print Content",false);
    win.setWindowSize(0,0);
    win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
    win.removeWindowFeature(WDWindowFeature.MENU_BAR);
    win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
    win.removeWindowFeature(WDWindowFeature.STATUS_BAR);
    win.setWindowPosition(200,200);
    win.show();
    * END: Open new window: download button
    For this if I try win.destroy() or win.close() or win.hide(), after win.show
    this doesn't shows the download options at all (quite obviously   ).
    I want to close this blank window automaticaaly once the user selects
    any option for download. Is there any solution to this or am I doing something wrong?
    Helpful answers will be appreciated. Thanks in advance.
    Regards,
    Gaurav Bhardwaj

    Hi Gaurav,
    If the external window contains the view of the wd component then only you can close the window.
    Try like this:
    Create a context attribute of IWDWindow in the calling view - component - called view and map them in all controllers.
    //set the context attribute  in calling view
    win.show();
    wdContext.currentContextelement().setWinref(win);
    * END: Open new window: download button
    In onActionxxx event of the downlload button
    // close the window
    wdContext.currentContextelement().getWinref().destroyInstance();
    Regards,
    Siva

  • Close external window in NW04s

    Hi,
    We are using the following API in order to close an external window: TaskBinder.getCurrentTask().getClient().sendRedirect("javascript:window.close();",0);
    After closing the window, the object in the backend system remain locked (and not released). it seems that the session remains alive and hence the object is locked.
    If we close the window with the X of the window, the object of the backend is released as required.
    As suggestions?
    Thanks,
    Aviad

    Hi AVIAD,
    Check this.
    Step 1: Take a context attribute(WindowInstance) of type “com.sap.tc.webdynpro.services.session.api.IWDWindow”.
    Step 2: Take a CloseButton in the View(DisplayView) that is used as a embed View of external Window.
    Step 3:
    When you are calling the external window set “WindowInstance”
    public void onActionDisplayExternal Window(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionDisplayResult(ServerEvent)
         IWDWindowInfo windowInfo =(IWDWindowInfo) wdComponentAPI.getComponentInfo().findInWindows(
         "DisplayWindow");
    //        create the Window
         IWDWindow window = wdComponentAPI.getWindowManager().createWindow(windowInfo, true);
         window.setWindowPosition(WDWindowPos.CENTER);
         window.setTitle("WindowTitle");
         window.setWindowSize(100,100);
    //        Save WindowInstance in Context
         wdContext.currentContextElement().setWindowInstance(window);
    //        and show the window
         window.show();
         //wdThis.wdFirePlugInDisplay();
        //@@end
    Step4: Associate action “CloseWindow” with the “CloseButton
    ” and destroy the window instance inside it.
      public void onActionCloseWindow(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionCloseWindow(ServerEvent)
       IWDWindow window = wdContext.currentContextElement().getWindowInstance();
       window.destroyInstance();
        //@@end
    External Window
    Re: Exit button error...
    Regards,
    Mithu

  • Close the Window on Button Click.

    please can someone help.
    I am trying to close the window in which my 'Exit'button is defined.
    For this I am using:
    button.addActionListener(this);
    public void actionPerformed(ActionEvent e) {
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         //dispose();
    But the window still doesnt close,till I click on the 'X' icon.

    action{
    if(e.getSource() == myButton){
    jframe.setVisible(false)
    // possibly jframe.dispose() depending on what you are trying to do
    //if you are tying to exit the program all together
    System.exit(0);
    }http://mindprod.com/jgloss/close.html
    xpost
    http://forum.java.sun.com/thread.jspa?threadID=764106&tstart=0

  • Close browser window using FPM

    Hi all,
    My requirement is to close the browser window on click of a button in the webdynpro component.
    I have triggered  FPM event gc_event_close in after action of that view.
    The window gets closed perfectly if I execute the application from SE80.
    But the window is not getting closed when I run the application from portal, instead I get a message saying' The application is closed, you can now close the window'
    Any pointers on closing the browser window when the application is run from portal would be of great help.
    Thanks in advance.
    Veda

    I can confirm this behavior. You can change this behavior by adding code in process_event method.
    1. Fire a portal event with
    "urn:com.sapportals:navigation", "CloseWindow", ""
    OR
    1. Fire a Exit plug with close_window = abap_true
    [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/ca3351508f04e7e10000000a42189c/frameset.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/ca3351508f04e7e10000000a42189c/frameset.htm]

  • Close external window from source application

    I am trying to close the external browser window from the source application (wda). But it seems that I am unable to close from the source window, just by calling close method. This close method has a parameter '  control_to_focus_id' . I am not sure what exactly it needs to be filled with.
    But anyways these act like two separate sessions and can't communicate any longer.
    Is there a way for me to control the external window and close on some user action at source/
    Any inputs would be highly appreciated.
    Thanks

    Hi,
    External window is independent of source window, you cannot control it from source application. May I know what is your requirement!
    Regards,
    Kiran

  • How can we close the window using a button in applet?

    I have a close button in my applet which should close the browser from where the application is launched. Can somebody post a sample code for doing the same?

    I'm afraid I don't have any sample code, but I can describe a possible solution.
    1. Retrieve the JSObject via Application.[url http://docs.oracle.com/javafx/2/api/javafx/application/Application.html#getHostServices%28%29]getHostServices().[url http://docs.oracle.com/javafx/2/api/javafx/application/HostServices.html#getWebContext%28%29]getWebContext()
    2. Use the JSObject to manipulate the JavaScript into closing the Window.

  • Close firefox window using javascript

    how to set dom.allow_scripts_to_close_windows to false

    You can inspect and modify prefs on the <b>about:config</b> page.
    *http://kb.mozillazine.org/about:config
    *http://kb.mozillazine.org/Prevent_websites_from_disabling_new_window_features
    *http://kb.mozillazine.org/JavaScript#Advanced_JavaScript_settings
    Type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key to open the <i>about:config</i> page, just like you open a website by typing the URL in the location bar.
    *If you see a warning message then you can confirm that you want to access the about:config page.
    *use the Search bar at the top of the about:config page to locate preferences more easily
    *preferences that have been modified and do not have the default value show as bold (user set)
    *preferences that are user set (bold) can be reset to the default value via the right-click context menu
    *preferences can be changed via the right-click context menu: Modify (String or Integer) or Toggle (Boolean) or by double-clicking the line with the pref
    *preferences can be created via the right-click context menu: New -> String, Integer, Boolean

  • How to open an URL and close the URL window, using adobe javascript

    Hi,
      Is it possible to open an URL and close the URL back again(without allowing the user to perform any other operation)? I was able to acheive the opening of the URL, using the app.launchURL("address". true); - But here it lauches in new window, and how do i close the window using the javascript. Is it possible?
    Thanks.

    Hi all
    In addition to what Bobby W - Adobe TS added, you might find
    the following useful as a bypass or workaround to the pesky prompt.
    var pw=window.parent;pw.opener=window.self;window.open("
    http://www.adobe.com");
    pw.close();
    I think this will only work for IE browsers. Actually, I
    think the whole window.close() only works for IE, but could be
    wrong about that.
    Cheers... Rick

  • Closing the external window

    Hi,
    I am new to webdynpro ABAP, please someone help me in how to close the extenal window, from the application running on the external window.
    I am actually creating a URL for a webdynpro component and I am running it on the external window, now I want to close the application browser, so that I can go back to the source window.
    Regards,
    Kamaraj

    Hi,
    if you are using URL external window then they are two separate sessions. You have no connection as parent and child window and nothing forbids the user to go from one window to another window.
    If this is really your use case and you want to close your own application/window by an button action or event handler method. Then you have to find out a way to close your application by an action.
    see this forum discussion.
    [FORUM|Re: Close External Window in Web Dynpro Application]

  • Getting hang/crash problem when I try to close browser window from applet

    I have a small Apllet that has a button that calls a Javascript function in the opening window, to close the window in which it is loaded.
    The Applet window is a PopUp window from one of my application's window. First time I start my application and load that Applet the button works fine. It calls the Javascript method and the Method closes the window using the self.close() method.
    But now if I open the applet window again and click on the button to close the windows, it hangs. I put in trace statements and saw that it hangs on JSObject.getWindow() window.
    I am using JDK Plugin 1.4.2_07 and 5.0 , if I work out on IE browser, it works fine.But when I use firefox or mozilla it gives problem of hanging/crashing.
    Note that in case of 1.4.2_07 this problem experienced some times but in case of 5.0 it gives always for other than IE browser.
    Please, if somebody could give me some clue about why this would happen, I will really appreciate that. and code related to this is given below
    import javax.swing.JApplet;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import netscape.javascript.JSObject;
    public class TestApplet extends JApplet implements ActionListener{
    protected JButton closeButton = null;
    protected JSObject win = null;
    private JFrame frame = null;
    private boolean alreadyClosed = false;
    public void init(){
    this.win = JSObject.getWindow(this);
    this.closeButton = new JButton("Close Browser Window");
    this.add(this.closeButton);
    this.closeButton.addActionListener(this);
    frame = new JFrame("Test Frame");
    frame.setSize(300, 400);
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.out.println("windowClosing");
    alreadyClosed = true;
    TestApplet.this.stop();
    frame.show();
    public void actionPerformed(ActionEvent ae){
    stop();
    public void stop() {
    if (!alreadyClosed) {
    alreadyClosed = true;
    frame.dispose();
    closeLaunchedBrowser();
    System.gc();
    System.runFinalization();
    private void closeLaunchedBrowser() {
    final TestApplet thisObject = this;
    Runnable r = new Runnable() {
    public void run() {
    try {
    JSObject win = (JSObject)JSObject.getWindow(thisObject);
    if (win != null && win.toString() != null) {
    //win.eval("top.opener=self;self.close();");
    //win.call("close", null);
    win.eval("self.close();");
    } catch (Exception e) {
    Thread t = new Thread(r);
    t.start();
    Thanks.

    I am waiting for any reply. I have tried for all these below options still I am getting Problem. I heard this is because of javascript, it wont call methods more times .Thats
    why I need other than JSObject or java script solution.If some one know anything about this or any modifications I have to made for the below options to avoid that problem please let me know.
    // URL durl = new URL(thisObject.getCodeBase(), "test/CloseMe.htm");
    // System.out.println("URL :" + durl.toString());      
    // thisObject.getAppletContext().showDocument(durl);
    //     thisObject.getAppletContext().showDocument(new URL("javascript:window.close();"), "_self");
    //win.eval("top.opener=self;top.close();");
    //win.call("close", null);
    //Object[] args = { "close", new Integer(50) };
    // win.call("setTimeout", args);
    //win.eval("setTimeout("close", new Integer(50));");
    If it is the problem of JRE I just need it should work on 1.4.2_01 or higher.
    thanks.

  • How can I close one window without closing all open windows?

    If I open more than one window, I can't close just one. When I try to close just one, I'm warned that I'm about to close more than one (all of them) but I'm not told how to close just one.

    Are you sure you aren't getting tabs confused for windows? If you close a window containing multiple tabs, Firefox should give you a warning that you are about to close several tabs. To close a tab do one of the following:
    * click the x at the right end of the tab (when you only have a few tabs open)
    * open the tab you want to close, then click the x that appears
    * right click the tab and select 'Close Tab'
    * open the tab you want to close and press Ctrl+W
    You can close a window using Ctrl+Shift+W.

  • Create External Window in Webdynpro for Abap

    I am creating an external window using method CREATE_EXTERNAL_WINDOW.  The componentcontroller context and the assistance class attributes are not available in the Handledefault method of the external window.    Is there a way to pass data to the external window without using URL parameters?
    Thanks
    Cindy

    >@Thomas: with all your wonderful eLearnings on WDA is there one which covers this in any depth? As it would be nice to point people to it.
    No I can't say that I have ever created something specifically on this.  The ACFUpDownload example is closest simply because I use the cache table is a similiar way, althought I hesitate to recommend that eLearning in this situation becuase that aspect isn't central to the eLearning and it might just confuse things further.
    >don't forget about the possibility of database persistence of the data either -
    That was actually what I was talking about in server cookies as well. Server cookies are something that was originally created for BSP, but work fine in WDA as well.  They are just a cluster table where you can store any data you want and access in another session via a key. The nice thing about server cookies is that there is already a help class for read/write and batch job that can be scheduled to clear out expired entries.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/2a/31b97b35a111d5992100508b6b8b11/frameset.htm

Maybe you are looking for

  • DW MX - Dynamic Templates and math

    I have created a template for displaying product information and collecting order information using Dreamweaver MX. Without including all of my checks and balances, below is the repeating area of the page. What I am struggling with now is figuring ou

  • How do I disable logging in to store?

    Ever since the recent "upgrade" to iTunes 10.5.1, every time I start it, it wants me to automatcially log in to the store. I don't want to use iTunes to stuff, I don't want to have to click disable every time I start it.  How do I disable this featur

  • Custom size manual feed?

    Why do envelopes default to a manual feed, but custom sizes pull from the main paper tray? Can you change which feed type the custom size defaults to? I have a Lexmark E234n mono laser printer which works just fine. I like to print odd sized stuff, t

  • URl in popup message

    Hi, I was able to populate the pop up with text in it. i have one more issue . I concatenated URL along with the text as below. Though the 'Text for URL (Guide in this case)' is been grayed out its not providing the 'Hand link' to the URL . DATA: w_u

  • TMG 2010 - Webaccess becomes unresponsive

    Our TMG 2010 server is set up in a test situation and is currently only used for outbound Internet access, no inbound connections yet pointing to this route.  We have been struggling with the issue that users using this outbound route will loose inte