cancel
Showing results for 
Search instead for 
Did you mean: 

SAP BI7 POST command to iFrame possible?

former_member589205
Participant
0 Kudos

Hi All,

I created an iFrame inside a page. The idea is to send POST commands to iFrame page using standard SAP JavaScript commands (like sending filter values, hide/unhide items etc.). Below is the approach I use but it doesnt work. I hope somebody can point out a way to make this work or give suggestions on another approach.

SAP BI has a JavaScript global object derived from sapbi_PageClass called sapbi_page and this is the global object to use for adding and sending commands.

In order to initialize a new object from sapbi_PageClass class that refers to the iFrame, I use the following constructor function which i found in the sapbi_070_pageclass.js. The constructor accept a window object as parameter.

var zsapbi_cmtpage = new sapbi_PageClass( window.frames["commentFrame"].window );

I use the following command to add a new command sequence. The example below is to hide document item. Note that the function zbicmd_changeVisible() is a customized function. This is already proven to work elsewhere.

var zcmdSeq = new sapbi_CommandSequence(); zcmdSeq.addCommand(zbicmd_changeVisible("SINGLE_DOCUMENT_ITEM","SINGLE_DOCUMENT_ITEM_1",0));

I found this method in sapbi_070_pageclass.js to send command over to other frames.

zsapbi_cmtpage.formSendParameterList2TargetFrame(zcmdSeq,"commentFrame");

The above script doesnt work as the method formSendParameterList2TargetFrame() failed on line 85 of sapbi_050_commandform.js - this.m_pFormElement.appendChild( paramField );

Any Ideas??

Thanks & Regards,

Wira

Accepted Solutions (1)

Accepted Solutions (1)

mike_howles4
Active Contributor
0 Kudos

This may or may not be the issue, but where you have:

var zsapbi_cmtpage = new sapbi_PageClass( window.frames\"commentFrame\".window );

If you are using MSIE, I believe it should be (I'm leaving out the \escaped\ characters just for clarity):

var zsapbi_cmtpage = new sapbi_PageClass( window.frames["commentFrame"].contentWindow );

or, assuming that you've given your IFRAME an ID of 'commentFrame', try it this way maybe also:

var zsapbi_cmtpage = new sapbi_PageClass( document.getElementById("commentFrame").contentWindow );

One thing maybe also to note is that the JavaScript will not be able to manipulate the IFRAME if its SRC tag is either not set or set initially to a page not within the domain of the calling page. So try also setting the IFRAME's SRC to a landing page that's within the same document.domain if you haven't already.

If you are still having problems, message me with maybe more complete example source code and I'll see if I can look further.

Answers (1)

Answers (1)

former_member589205
Participant
0 Kudos

Hi Mike,

Thanks for the reply. Actually I did type the code exactly like below but somehow the forum change the bracket to slash.

 var zsapbi_cmtpage = new sapbi_PageClass( window.frames["commentFrame"].contentWindow ); 

Also did try the following code before, same issue.

 var zsapbi_cmtpage = new sapbi_PageClass( document.getElementById("commentFrame").contentWindow ); 

When I debug the JavaScript, I found that I can access some properties of the iFrame such as location.href, location.port , URL but I couldnt access the iFrame JavaScript variables, objects or functions.

The iFrame page is from the same domain as parent page and they're both using secure http.

I'll send you a message with the full codes later. Appreciate your time. Thanks

Regards,

wira

mike_howles4
Active Contributor
0 Kudos

I just thought of something else, if your IFRAME is pointing to an iView, you probably have to go one layer deeper, since an iView holds an IFRAME inside of itself as well:

var zsapbi_cmtpage = new sapbi_PageClass( document.getElementById("commentFrame").contentWindow.document.frames[0].contentWindow );