cancel
Showing results for 
Search instead for 
Did you mean: 

Bookmark in EP - JavaScript error "Permission Denied"

Former Member
0 Kudos

We are implementing the bookmark functionality in BW Web Reports. Web reports are then made available to end users using SAP Enterprise portal.

In order to achieve the bookmark functionality we have used the code as published in the BW Expert magazine Issue Jan 2004. If a web report is executed on the WAS server, the bookmark works fine.

However the same report when executed from EP Portal, we get a JavaScript “Permission denied” when executing the bookmark.

Appreciate if you can share your thoughts on how to resolve this issue.

Thanks, Jay

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Make sure you set the document.domain property of the bw template the domain of the of the server.

Thanks.

Former Member
0 Kudos

I checked that the domain of the web template and the domain of the child popup window are the same.

I think the problem is that our portal is on xxx.company.com but our web templates are on yyy.company.com.

I dont understand why everything works fine when i run it directly on WAS but when I run from the portal, i get that javascript "permission denied" error.

Any help is appreciated.

Former Member
0 Kudos

Even though the property reads the same some time you have to set the domain property in the code to get rid of this error.

Thanks.

Former Member
0 Kudos

Oh ok. I will try.

To what extent should the domain be?

document.domain = ???

Former Member
0 Kudos

Have this line of code in the javascript function.

document.domain = "mydomain.com";

Thanks

Former Member
0 Kudos

It doesn't work for me.

I placed the code in the javascript function.

Maybe there's a specific place it needs to go?

This is getting frustrating!

Thanks.

Former Member
0 Kudos

Okay, when is that you are geting the error. Is it whenyou load the template inside the portal, if so it should go in the onload event of the template. let me know the details..

Former Member
0 Kudos

On my web template i have a text box for the user to enter some value. And there's a submit button. When the submit button is clicked, the javascript function gets executed. This is the code for the javascript function:

function addToFavorites() {

report_name = document.getElementById('rept_name').innerHTML;

report_name = report_name.replace(/ /g,"%20");

text = window.document.forms["input_text"].elements["add_to_fav_text"].value;

text = escape(text);

// > Begin code from BWExpert Volume 2 (2004) - Issue 1 (January) <

var bwUrl = "<SAP_BW_URL CMD='BOOKMARK'>";

//Open the child window to generate the BW bookmark url.

child1 = window.open(bwUrl, 'win1', 'width=1,height=1,alwaysLowered=0');

window.focus();

var pageTitle = document.title;

//Ensure that BW completed generation of the bookmark url.

now = new Date();

startTime = now.getTime();

delayTime = 30000; //Set timeout to 30 seconds

waitTime = startTime;

//check if the bookmark url is ready and timeout after the specified time (delayTime).

while (waitTime<(startTime+delayTime)) {

now = new Date();

waitTime = now.getTime();

//BW identifies a bookmark using BOOKMARK_ID. The presence of this string

//in the url is used to identify creation of the bookmark. If bookmark

//is created on the server, proceed to the next step.

document.domain = "mydomain.com";

if (child1.location.href.indexOf("BOOKMARK_ID") > 0) break;

}

// > End code from BWExpert Volume 2 (2004) - Issue 1 (January) <

bookmark_url = escape(child1.location.href);

//Add bookmark

bsp_url = "/sap/bc/bsp/sap/z_add_to_fav/addCustomText.htm?TEXT=" + text + "%20(" + report_name + ")" + "&URL=" + bookmark_url;

child1.close();

SAPBWOpenURL(bsp_url);

}

I partially follow the code from BWExpert Magazine. Their code opens a child window which creates the bookmark. The parent window grabs the URL from the child window.

I pass the URL of the bookmark to a BSP which adds the URL of the bookmark to the users favorites.

Thanks,

Audrey

Former Member
0 Kudos

Is this template inside the Portal or stand alone template? Did you try setting the document.domain property at the begining of this fucntion? We have almost similar code and it works fine.

Thanks.

Former Member
0 Kudos

This javascript function is in the BW web template. The BW web template is then attached to a BW Report iview in the portal.

Yeah, I put the document.domain in several places and I still got the javascript error message.

Former Member
0 Kudos

The javascript "permission denied" error occurs on this line:

if (child1.location.href.indexOf("BOOKMARK_ID") > 0) break;

Former Member
0 Kudos

Looks like you are doing some cross frame scripting. What is child1? In this case you need to make sure both the windows are set to the same domain thru code. i.e try setting the domain for both the windows in the onload event to the same domain.

Good Luck

Former Member
0 Kudos

child1 is the popup window that creates the BW Bookmark.

Former Member
0 Kudos

I implemented the bookmark functionality some time ago and found that if I put the javascript code into a module on the BW server, and then included the javascript file, then I got a similar error.

If i included the javascript within the actual web template, then I didn't get this error.

Unfortunately this means that I have to add in the javascript functionality to every web template that I use, instead of being able to put a reference to the .js file on the server, but at least it worked.

Not sure how you have implemented it, so this may not be helpful.

Former Member
0 Kudos

Jayant,

I'm having the same issue. Did you find a solution?

Thanks.

Former Member
0 Kudos

Hello,

I have implemented the SAP Enhance Web reporting functionality but it's lacking a few bit and pieces.

Is there anyone out there who know how I can set a web page to landscape from a web template?

Come on, someone out there must have beaten this probelm.

Thanks

Paul.

Former Member
0 Kudos

Hi Paul,

do you mean to set the web page to landscape for printing?

Michael