Close an external Window
Hi Colleagues,
I am facing a problem with close button
Here the scenario is i am opening one application from an another application by using "createNonModalExternalWindow". and the opened application there is aclose button.
calling the second application by following code
WDDeployableObjectPart deployableObjectPart =WDDeployableObject.getDeployableObjectPart(
"preq","Prerequisites",WDDeployableObjectPartType.APPLICATION);
String urlToTargetApp =WDURLGenerator.getApplicationURL(deployableObjectPart, urlParameters);
window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(urlToTargetApp);
On click of the close button in second webdynpro application ,i am calling a method in the first application which should destroy the window instance.
window.destroyInstance();
Window is returning a avalue called "[email protected]9e"
But with the above destroy instance method this window is not getting closed.
Please let me know How can this window be closed
Many Thanks & Best Regards
Swetha
Hi,
First create a context attribute va_window of type com.sap.tc.webdynpro.services.session.api.IWDWindow (to create this type of attribute You need to click on button given with dropdown for select type of attribute, then click radio button javanative type, then browse,then type iwdwindow in that and select IWDWINDOW) in component controller then map this attribute to both the views.
After That set this attribute after opening your window.
WDDeployableObjectPart deployableObjectPart =WDDeployableObject.getDeployableObjectPart(
"preq","Prerequisites",WDDeployableObjectPartType.APPLICATION);
String urlToTargetApp =WDURLGenerator.getApplicationURL(deployableObjectPart, urlParameters);
window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(urlToTargetApp);
wdContext.currentContextElement().setva_window(window);
Then in the Event handler of close button get the value attribute in following manner and call method destroyInstance();
IWDWindow window = wdContext.currentContextElement().getva_window();
window.destroyInstance();
I hope it helps.
Regards,
Rohit
Similar Messages
-
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.... -
Close the External Opend window on click of button
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.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' ) -
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,
AviadHi 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 -
Hello,
I would like to close an external window dynamically by calling the method
lr_myextwin->close( ) when some event occurs.
This does not seem to work since the opened external window is still open...
Ofcourse it is possible to manally close the external window, but I would like it to happen dynamically.
Can any brief me in, if it possible.
Cheers,
GeraldHi Jagruti,
Its possible to close the external window dynamically.What you have to do is , while creating the external window instance, save the instance in the component controller as an attribute .
Which means create an attribute in the component controller of type IF_WD_WINDOW ( In this case i have created LO_POP_UP ).
l_cmp_api = wd_comp_controller->wd_get_api( ).
l_window_manager = l_cmp_api->get_window_manager( ).
CALL METHOD L_WINDOW_MANAGER->CREATE_WINDOW
EXPORTING
MODAL = ABAP_TRUE
WINDOW_NAME = <WINDOWNAME>
TITLE =
CLOSE_BUTTON = ABAP_TRUE
BUTTON_KIND =
MESSAGE_TYPE = IF_WD_WINDOW=>CO_MSG_TYPE_NONE
CLOSE_IN_ANY_CASE = ABAP_TRUE
MESSAGE_DISPLAY_MODE =
DEFAULT_BUTTON =
RECEIVING
WINDOW = l_final_window
When you get the instance of the window.Save it in the component controller attribute.
wd_comp_controller->LO_POP_UP = L_FINAL_WINDOW.
CALL METHOD L_FINAL_WINDOW->OPEN
At later point of time , you could get this instance from compenent controller and you can call that in your method whenever and whereever necessary , so that you could close the window in a smooth fashion.
mywindow = wd_compcontroller->LO_POP_UP
mywindow.close().
Thanks
Anzy.
mark this thread as closed if this solves your problem. -
[External Window] Reuse an existing window
Hi,
From what I have read, this is not possible to close an external window from the parent web dynpro application (external means opened through create_external_window method).
In spite of what the SAP Help documentation is saying (http://help.sap.com/saphelp_nw70/helpdata/en/43/79f82ccbec6fcde10000000a1553f6/frameset.htm), I did manage to open an external window from SAP Enterprise Portal .
As this is impossible to close the external window* (programmatically !), I was wondering whether it was possible to "reuse" the window (usually, setting the target attribute of an HTML hyperlink does this trick). Unfortunately, I haven't found the target attribute (which is different from the title attribute).
Is this possible to inject the target attribute in the new window?
Thanks in advance.
Best regards,
Guillaume
To be honest, there is lot of contradictions regarding this aspect. Indeed, it is stated in NET311 Training guide that it is possible to close a window opened with create_external_window and OSS Note [1234843|https://service.sap.com/sap/support/notes/1234843] also seems to say so (we are operating 7.01 SP03)
Edited by: Guillaume Garcia on Jan 7, 2010 11:12 AMUnanswered
-
Hi,
I want to close an external window (an external running application, such as InfoConnect, or NotePad etc) using a simple java program. Is it possible? What is the command to close an external window? And how do I know which window to close?
For example, there's a running application, called info-connect, and another independent java program running. How can I close the info-connect window without disturbing the other program? (is there a name for the window or something)
Thank you very much!!! Wish you all the best~
- AnsonSorry, I hit the 'post' button a little too quick.
If it's really independent, it's gonna be very hard - though a Robot might get you somewhere.
But more importantly, there's a reason for that. How would you like it if a program just decided that a window it hadn't opened, needed to be closed? I'd find it irritating to say the least.
Don't close what you do not own.
Otherwise:Process p = Runtime.getRuntime().exec("MyProgram.exe"); // start a process
... // do some stuff
p.destroy(); // kill itBut this is probably not what you mean by independent, right? -
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 BhardwajHi 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 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.
ThanksHi,
External window is independent of source window, you cannot control it from source application. May I know what is your requirement!
Regards,
Kiran -
Release of lock entry when external window closes.
Hi
I have created a external window for some URL which is created for VF02 transaction.
SET PARAMETER ID 'VF' FIELD lv_drftno.
CALL TRANSACTION 'VF02' AND SKIP FIRST SCREEN .
Now my problem is regarding lock entries.
The external window which is created is having a by default close button in upper right corner like explorer.
and if the user use this button to close the window in middle of the transaction the entery get locked.
So there is any method to release that entry on closure of window?
or can we get the event when user press that close button?If you are using it in TEST MODE swtich on the flag TESTRUN of the BAPI and after that even if you COMMIT the changes will NOT be there in the DATABASE.
Then the locks will be released and changes are also NOT committed to DB if you have the TESTRUN flag on.
Its not recommended that you unlock the locks manually.
Regards,
Ravi -
Closing the NonModel External Window in Webdynpro
Hi,
I have a Webdynpro Application, in which i used to call the webdynpro application in a Separate external window by using the below code.
String depObjectName =wdComponentAPI.getDeployableObjectPart().getDeployableObjectName();
WDDeployableObjectPart depObjectpart=WDDeployableObject.getDeployableObjectPart(depObjectName,"TestApp",WDDeployableObjectPartType.APPLICATION);
String url = URLGenerator.getApplicationURL(depObjectpart) ;
*// Code to Popup the View in External window by calling the Application *
window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(url,"Update View");
wdContext.currentContextElement().setCtx_WindowInstance(window);
window.setWindowSize(625, 225);
window.setWindowPosition(50, 75);
*window.setTitle("Update View"); *
window.show();
This opens the Separate external window and after editing some fields, I need to Update the DB and close the window.
When i try to use the code,
window.destroyInstance();
The window is not getting closed. I have used the window instance as the static IWDWindow window, still i am not able to close the window.
Anyone Please let me know how to close the External Non Model Window.
Thanks and Regards,
SekarHi Sekar,
my suggestion is to open another window that contains html code which invokes opener . close() on the parent window - your window to be closed. This worked for me and made my day.
I open an HTML file created as IWDCachedWebResource as nonModalExternalWindow over a LinkToAction which invokes onActionClose. There is a second window opening for a short moment which will be closed by its onLoad event.
The HTML code is basically sporting a < script >-section which contains a call to opener . close().
regards,
Christian
Ps: sorry, I can't post the code - it simply does not work... Had the same problem days ago with another thread . -
Open PDF in New External Window
Hi
how to open a PDF Report(File) in new IE Window from WebdynproJava
Regards
DhinakarHi,
If the PDF document is in the server then we can show that in the external window onClick of the button.
Write this code in the onAction button event.
try
byte[] content =this.getByteArrayFromResourcePath("<server path>\Guide.pdf");
String stResourcePath = new String("<server path>\Guide.pdf");
IWDCachedWebResource resource = WDWebResource.getWebResource(content, WDWebResourceType.PDF);
IWDWindow window = wdComponentAPI.getWindowManager().createNonModalExternalWindow(resource.getAbsoluteURL()," document");
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.open();
catch(WDURLException ex)
catch(IOException ex)
Paste this code here:
//@@begin others
private byte[] getByteArrayFromResourcePath(String resourcePath) throws FileNotFoundException, IOException
FileInputStream in = new FileInputStream(new File(resourcePath));
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len;
byte[] part = new byte[10 * 1024];
while ((len = in.read(part)) != -1)
out.write(part, 0, len);
in.close();
return out.toByteArray();
//@@end
Regards,
Vijai -
Application lock on open external window
Hi everybody,
I have problems with opening a new browser window pointing to a folder on the network.
If the user has access to the folder everything is working fine.
If the user has no rights to access the folder, the user gets an error message and the window stays empty. After clicking okay on the error message and closing the window the user can continue working in the application.
If the folder which should be display does not exist the user gets an error message.
After clicking oay on the message he can return to the application. But there the 'progress circle' is still running and it cannot abort or do anything! The user has to close the application and login again.
Is there a way to handle the external window in any way after having it opened and the calling method was left?
Any hint or advice is highly appreciated!
Best regards,
RolandHi,
Do this way... So that there will not be a minimise option, close option. and control will be there inside the Window and till the time user closes the window he cannot perform any actions on any other screens.
//Added below code to open a new window
IWDWindowInfo info =
wdComponentAPI.getComponentInfo().findInWindows("WD_vendorTable");
//Where WD_vendorTable is a window with the desired view embedded inside it.
IWDWindow win =
wdComponentAPI.getWindowManager().createModalWindow(info);
wdContext.currentContextElement().setVa_VendorWinName(win);
//Save this window information in a context variable(declared at component level and mapped to the parent view and to the window(child) view)
win.setWindowSize(300, 300); //Desired window size
win.setWindowPosition(600, 100); //Desired window position (from top left cornor)
win.setTitle("Vendor Details"); //Desired window title
win.show();
To close this window
create a button inside it and inside the button's action
IWDWindow win=wdContext.currentContextElement().getVa_AssetNoWinName();
win.destroyInstance();
Regards,
Srinivas. -
How lock or hide URL LOCATION in a external windows WDA
Hello guys...
I am traying to hide or block the URL which i am using in a external window. I have coded this:
call method lo_window_manager->create_external_window
exporting
url = lv_url
modal = abap_true
has_menubar = abap_false
is_resizable = abap_true
has_scrollbars = abap_true
has_statusbar = abap_false
has_toolbar = abap_false
has_location = abap_false
receiving
window = lo_window2.
*lo_window2->open( ).
But, firstly the MODAL parameter doesn't work with external windows (It's Obsolete) So I can't use it, because I have to forbid the navigation between windows. I tried to close the main windows before open URL but it doesn't work either.(Appear a waring that you window wants to be closed) so then I used that:
lo_windows->fire_exit_url_plg(
url = lv_url " string
lo_windows = wd_this->get_windows_ctr( ).
lo_windows->fire_exit_close_plg(
close_window = 'X' " wdy_boolean
That is Ok BUT I can't BLOCK the URL or even HIDE it. SOMEBODY give the light.!!!!! pleaseee..You are complexing with 2 problem with 2 options.
1. Blocking url on the external window
2. Closing the previous window.
1. parameter model is indeed obsolete, so only has location parameter would help you to block the URL and it will not work for the requirement 2.
2. When you use exit plug and navigate to new URL, your window would close but new window would not open with address bar blocked.
No solution is fitting for your both requirements.
Probably you have seen this example application WDR_TEST_EXIT_WITH_CLOSE
See if it fits in your case. -
Opening External Window in Web Dynpro ABAP with URL disabled or Hidden
Hi Experts, I have a requirement where-in we want to open the Web Dynpro ABAP application using tcode WDYID (by passing the application name and startmode), but the URL of the newly opened explorer should be disabled or hidden. To achieve the same, I have created a component (lets name it PARENT) and inside that in DOMODIFY/DOINIT method have written code to invoke the required WDA (lets name it CHILD) in external window (by using lo_window_manager->CREATE_EXTERNAL_WINDOW) and is successfully able to open the application with URL disable using different parameter of method CREATE_EXTERNAL_WINDOW. But in this case there are 2 window which opens, one is for PARENT view and other is for CHILD. Now I only want to keep the second view (CHILD) to be opened and want to close the PARENT view. When I used EXIT_PLUG to close the PARENT window, it closes both the window. Need your inputs on my approach or if you have any. Regards, Harish
Hi,
If you open the popup, it opens as Modal Window, originating from Parent window. Without external window( where you can pass has_location = abap_false ), you cannot hide the URL/Address bar.
If you want to partially hide the URL( if you dont want to show the full URL with application path), you can create an Alias for the service in SICF.
Go to SICF, and create an alias for your WDA application; say original URL: domain:port/sap/bc/webdynpro/sap/<ZAPPLICATION_NAME>
This URL you can convert( partially hide) as, domain:port/sap/<ANY_NAME>
Refer creating Alias in this help: http://help.sap.com/saphelp_sem320bw/helpdata/en/55/361a3c9c004866e10000000a11402f/content.htm
Hope this helps u,
Regards,
Kiran
Maybe you are looking for
-
Claims Digger report - values for changes in duration/float/lags
When I compare two projects using Claims Digger, I always get results for changes in durations, float and lags in hours as opposed to days? Is there a setting that can fix this? Please advise. Thanks!
-
Just installed Acrobat XI and many of the tool buttons are greyed out.
This is Acrobat Standard. Why would the edit buttons be greyed out? Lee
-
Installtion of Sun DSEE7.0 on Solaris 10 x86 error
When attempting to install, either by native package or by zip package, the dsadm create /dsInst command always returns the error: Invalid argument. The return code is 126. Both the native package install and the zip package install without any error
-
HELP!: Canon Rebel XS Changing Settings Randomly and Not Taking Photos!!
PLEASE HELP! This is a very desperate attempt at reaching out for help before I THROW MY CAMERA AT THE WALL! Frustration level 1000 reached. The problem: I power up my Canon Rebel XS (purchased in 2009 and treated like my baby), point it at the subj
-
ITunes will not convert file to AAC, please help.
I have a rather large file, an audiobook to be precise. It is in .mp3 format and is approximately 8.5 hours long. I would like to convert it to AAC but iTunes does not seem to want to convert it. It seems to convert the file until the last few second