cancel
Showing results for 
Search instead for 
Did you mean: 

Opening new window... good practices ?

Former Member
0 Kudos

Hi all,

In my application, I need to implement a Print report functionality.

To do so, I'd like to have a button that, when clicked, opens a new IE window containing the report to be printed out.

I have created a window in my current component (I have only one component in my application), named reportWindow.

Now, I'd like to open this reportWindow in a new IE window.

I've read threads talking about this... but couldn't figure out what is the best practice to do so:

- If I use <i>createExternalWindow</i>, I need to specify URL (and not window name). Doing so, I face a problem: if I give the URL of my current application, then the application itself is being displayed in the new IE window.

-> Should I create a new application (let say reportApplication) and give its URL as parameter to createExternalWindow ?

-> Or should I pass parameters through URL so that my current application know which window to display ?

- If I use <i>createWindow</i>, the report is being displayed in internal window, that is not suitable for printing

Actually, I'd like to avoid all of this possibilities... Isn't there any other way to do ?

I've read something about creating report in a variable of my context and fedding the content of this variable to a web page, but I can't figure out how to do this...

Thanks in advance for any help...

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Are you using the standard functionality of the browser to print or are you trying to use the window.print() functionality in your WebDynpro application.

First thing would be that if you are using window.print() in your webdynpro code then the functionality does not execute once the component is loaded and you try to click the button because it does not know which window it has to refer to.

If you could tell us what is the method you are using for printing the report then we can suggest accordingly.

Anyways to avoid the problem that you are facing with External window, you can do something like

Create 2 Windows, win1 and win2. Attach the report view to Win2. then in win1 make a call to createExternalWindow and pass the url to it. That should solve the problem.

Advantages of External Window would be

1. If you use createExternalWindow the window is a new Browser instance.

2. You can move the window.

3. If you want to use the browser functionality of print then this is easy.

In case you are maintaining your Webdynpro within a portal then you have to be careful in usage of createExternalWindow. You would have to ensure that the context is maintained

Otherwise it should be fine. Its just that under what scenario you want to acheive this.

Hope that helps you.

regards

ravi

Former Member
0 Kudos

Hi Ravi,

Thanks a lot for your answer...

At the moment, I don't know how users will be able to print the report (it actually depends on how the report is being opened).

The solution you suggested suits me well... But can you give me some more details about it ?

1. Which is the URL I must pass to the new window ? At the moment I'm facing two problems with that:

- As far as I understand, I must give the full URL of the application (meaning either hard-code it, or give it as a parameter for the application. Both way are not suitable for maintenance).

- Should I have a second application defined for win2 ? If not, can you please explain me how to tell the current application that, when opening ExternalWindow it has to display win2 ? At the moment, when I try to do so, the ExternalWindow being opened display my application from starting point (and not win2)

I'm not creating my webdynpro application in portal, so I think I won't have problems with context...

Regards

Former Member
0 Kudos

I believe you will have to create a different application for the external window.

The address of the present application will open up the current application.

Former Member
0 Kudos

Thanks...

I'll create a new application therefore...

By the way, is there any way to specify a relative URL ? Id'like to create my window as: createExternalWindow("secondApp", ...) if possible.

I tried several possibilities of specifying URL, but it seems WAS can only recognized rooted URL, I mean URLs starting from root (/webdynpro/dispatcher/...).

Former Member
0 Kudos

Hi

You can specify any URL, but like you said you will have to hardcode the url there. But anyway it is possible.

Hope that helps you.

regards

ravi