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

Similar Messages

  • How to close external programs?

    Hi there,
    in vbs is a command "ExtProgram(ExtProgramName, ExtProgramArg)" to
    start external programs. But how to  close external programs when
    they finished its work? Is there a vbs-command for it? Is there a way
    when calling "cmd.exe" with a proper parameter?
    Martin Bohm

    Hello Martin!
    Yes, with the tool 'tasklist' in the same directory.
    The problem is that it is not easy to query from script. I tried it in the following script. Perhaps not perfect espacially because a command interpreter pop up every time you call the function.Option Explicit
    If IsDIAdemRunning() Then
    Call MsgBox( "At least one DIAdem is running!" )
    Else
    Call MsgBox( "No DIAdem at all!" )
    End If
    Function IsDIAdemRunning()
    Dim oWshShell
    Dim oExec
    ' Execute via Shell Object
    Set oWshShell = CreateObject("WScript.Shell")
    Set oExec = oWshShell.Exec( "C:\windows\system32\tasklist.exe /FI ""IMAGENAME eq DIAdem.exe""")
    ' wait until tasklist is finished
    Do While oExec.Status = 0
    Pause(1)
    Loop
    ' no Standard Output -> no DIAdem running
    IsDIAdemRunning = Len(oExec.StdOut.ReadAll) <> 0
    End Function
    A better solution might be possible via WMI.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • How to close open windows with ios7, How to close open windows with ios7

    How to close open windows with ios7, How to close open windows with ios7?

    Guess they thought we needed more exercise so now we have to swip them to close.....miss iOS6. My eyes are blurry now after looking at my phone, and my arms are tired from swipping lol

  • How to close parent window when we use call method l_window_manager- create

    hi...
    how to close parent window when we use call method l_window_manager->create_external_window
    thank you.

    hi
    good
    go through this link,hope this ll help you to solve your problem
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/63a47dd9-0b01-0010-3d8e-de27242bf011
    thanks
    mrutyun^

  • How to close ie window?

    hi,
    i need to write a program that could open and close a particular url in ie browser for a particular number of times. i could open the browser using following code
    cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
    Process p = Runtime.getRuntime().exec(cmd);but i could not find how to close the window - please help

    p.destroy()... but how do you decide when to destroy the process -- are you using a timer or whuh?
    By the way, if you just want to open a browser in a platform independent way, you could try the new Desktop [browse |http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)] method.

  • How to close child windows when parent window closed in jsp

    how to close child windows when parent window closed in jsp
    becoz it can't be able to recognise it's parent
    with the whole application
    plz send me some sample code of it

    Hi, I have no idea how to do this is JSP.
    However createing a modal window (with javascript) would mean that the user can not use the parent window untill he closes the child window. However not sure if this is what you are searching.
    Otherwise you can detect the onClose (I think) and close the window from there.
    However both the above are JavaScript and not JSP.
    rwgards,
    sim085

  • 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 create external window on top of other window?

    I create an external window from my web dynpro component. How to make sure the new window is created on top, not in the back? My web dynpro component is accessed via sapgui and browser.
    Thank you
    Edited by: Vincent Cao on Jun 15, 2010 5:25 AM

    Yes, by default it should be on top.But mine is displayed in the background.
    Logic is:
    1 Window A (or SAPGUI A) has a pop window PA with a button "OK"
    2 Press "OK" button, PA window is closed. And fire an event to window A
    3 A get the event, refresh itself and create an external window.
    Part of codes:
          window = lo_window_manager->create_external_window(
              url            = i_url
              title          = title
              modal          = modal  " abap_false
              has_menubar    = has_menubar "abap_true
              is_resizable   = is_resizable "abap_true
              has_scrollbars = has_scrollbars "abap_true
              has_statusbar  = has_statusbar "abap_true
              has_toolbar    = has_toolbar "abap_true
              has_location   = has_location ). "abap_true
          IF width IS NOT INITIAL AND height IS NOT INITIAL.
            window->set_window_size( width  = width  height = height ).
          ENDIF.
          window->open( ).

  • 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 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 to close the window openned by System Exec VI automatica​lly?

    Hello,
    I am using System Exec VI to lauch an exe file built from a LabVIEW program. When running System Exec VI, the window of exe file pop out and stays there even after all tasks are completed. I have to close it every time manually. Anyone here know how to close the exe file window automatically when it's done?
    Thanks,
    Jean
    Message Edited by Jean_CLD on 03-25-2010 11:25 AM
    Message Edited by Jean_CLD on 03-25-2010 11:29 AM
    Solved!
    Go to Solution.

    If I understand the question correctly you need to add an invoke node at the end of your application to exit. Depending on the whether it is running as a stand alone application or within LabVIEW it will either exit or stop execution. I've attached the VI I use in my applications.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot
    Attachments:
    Exit application.vi ‏13 KB

  • How to close a window from program?

    How do I programmatically close a window so that the windowClosing() event is fired? I can't seem to find example code anywhere.
    Thanks, Brad

    Hi Brad,
    This is just a suggestion (I haven't tried it myself), but perhaps the "java.awt.Robot" class can help?
    http://java.sun.com/j2se/1.4.1/docs/api/java/awt/Robot.html
    Good Luck,
    Avi.

  • 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>

  • How to close child windows at logout?

    I was wondering how i can ensure that when a user loggs out,
    any related open child windows from that session are automaticaaly
    closed. The Application is written in ASP VBscript.
    Basically the user can logout two ways, either by clicking on
    the logout link or by closing the browser window. For the latter
    what i did was to create an even for the "onUnload" event of the
    browser. So when the user closes the window, it will also logg the
    user out.
    Now i also wanted to automatically close any child windows
    that the user may have opened when he either loggs out or closes
    the browser window. How can I accomplish that without prompting the
    user that the window is about to close?
    B.T.W. I use the
    window.open method to open the child windows, using either
    javascript or vbscript.

    Hi, I have no idea how to do this is JSP.
    However createing a modal window (with javascript) would mean that the user can not use the parent window untill he closes the child window. However not sure if this is what you are searching.
    Otherwise you can detect the onClose (I think) and close the window from there.
    However both the above are JavaScript and not JSP.
    rwgards,
    sim085

  • How to close browser window after user log out

    Hi,
    Does anyone know how I can close browser window after user logs out. The scenario is when user clicks a log out button I will invalidate user session and close the browser right away in the backing bean.
    Your help would be appreciated.

    Try run this and you'll see that it runs fine with no exceptions:
    <%
         String someText = "bla bla bla";
         response.setContentType("text/plain");
         response.setHeader("Content-Disposition", "attachment;filename=message.txt");
         try {
              ServletOutputStream os = response.getOutputStream();
              os.write(someText.getBytes());
              os.flush();
              os.close();
         } catch (Exception e) {
              out.println("ERROR: " + e);
    %>It looks like that after I've closed the outputStream I can't do any more processing in the JSP. Even if I remove the setContentType and setHeader methods it still behaves this way.
    I'm starting to think that there's no way around this...??

Maybe you are looking for

  • T540p I7-4710MQ running at 800Mhz

    Hi All, While installing my new t540p I noticed that my cpu is not throttling and keeps running at a slow 800Mhz when running at battery. When I connect the psu all seems to work fine, cpu speed throttles from 800Mhz to 3.5Ghz as it should. I bios ->

  • 13" and 1440x900 WXGA+

    Hello, The idea about what I am going to ask came from a friend of mine who succesfully replaced his XGA screen for SXGA without any difficulty on his Asus laptop. I want to ask about the compatibility between displays – is there any standardized kin

  • Nano SIM adaptor got stuck inside my Lumia 1020

    I forced to remove the nano SIM adaptor and after I tried a regular micro SIM and my Lumia 1020 gave me an error message saying SIM was not detected. I read many horrors stories like mine :-( I'm wondering if that happened to someone here on the foru

  • Photoshop eraser not working

    Ok I was just using photoshop, not doing anything differently and I went to use the eraser and set the opacity down a bit and put it over a picture but noticed doesnt erase and make the edges of the picture fade but makes a big line which has just lo

  • Use IDOCS to transfer development class

    Hi, can we transfer development class between 2 servers using idocs or we have to transfer data in development class individually? kindly tell how also. Thanks! Harsh