473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to Overwrite function before it run?

Hi everybody :)
I'm facing an issue while trying to display a page ( SAP BEx Report) on an IFrame.
There is a javascript function inside the the page make it keep refection.
I’m trying to overwrite this function before it run.
The src for the IFrame page :
Expand|Select|Wrap|Line Numbers
  1. <html><head><LINK REL=stylesheet HREF="/irj/portalapps/com.sap.portal.design.portaldesigndata/themes/portal/ARAMCO/prtl_std/prtl_std_ie6.css?7.1.5.0.1">
  2.  
  3. <!-- EPCF: BOB Core -->
  4. <meta http-equiv="Content-Script-Type" content="text/javascript">
  5. <script src="/irj/portalapps/com.sap.portal.epcf.loader/script/optimize/js13_epcf.js?7.01000020"></script>
  6. <script>
  7. <!--
  8. EPCM.relaxDocumentDomain();
  9. EPCM.init( {
  10. Version:7.01000020,
  11. Level:1,
  12. PortalVersion:"7.0105.20090812092945.0000",
  13. DynamicTop:false, // [service=true nestedWinOnAlias=false]
  14. UAType:1, // [MSIE]
  15. UAVersion:8.0,
  16. UAPlatform:1, // [Win]
  17. UIPMode:"1", // [Default=1, User=0, Personalize=true]
  18. UIPWinFeatures:"",
  19. UIPPortalPath:"http://dvb.aramco.com.sa:52000/irj/portal",
  20. UIPPopupComp:"/irj/servlet/prt/portal/prtroot/com.sap.portal.epcf.admin.WorkProtectPopup",
  21. UIPPopupCompSize:"dialogWidth:450px; dialogHeight:200px; status:no",
  22. UIPPopupMsgNN:"",
  23. UIPPopupMsgND:"",
  24. DBGException:false
  25. } );
  26. EPCM.DSM.init( {
  27. TerminatorURL:"/irj/servlet/prt/portal/prtroot/com.sap.portal.dsm.Terminator",
  28. WinEmptyUrl:"/irj/portalapps/com.sap.portal.dsm/images/empty.gif",
  29. ForcedUserDebug:false,
  30. KeepAliveActive:false,
  31. KeepAliveDelta:840,
  32. KeepAliveStopAfter:36000
  33. } );
  34. function SAPWP_receiveSessInfo( sessInfo, frameRef ){
  35.   EPCM.DSM.processSession( sessInfo, frameRef );
  36. }
  37. //-->
  38. </script>
  39. <!-- EPCF: EOB Core -->
  40.  
  41. <script type="text/javascript">
  42. /*HTML Business for Java, 701_SP_TEST, 528954, Sat Jul 11 21:55:20 AST 2009*/
  43. ur_system = {doc : window.document , mimepath :"/irj/portalapps/com.sap.portal.design.urdesigndata/themes/portal/ARAMCO/common/", stylepath : "/irj/portalapps/com.sap.portal.design.urdesigndata/themes/portal/ARAMCO/ur/", emptyhoverurl : "/irj/portalapps/com.sap.portal.htmlb/jslib/emptyhover.html", is508 : false, dateformat : 1, domainrelaxing : "MINIMAL"};
  44. </script>
  45. <title >SAP NetWeaver Portal</title><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"></head><body class="prtlBody urFontBaseFam urScrl">
  46. <!-- EPCF: Component com.sap.portal.appintegrator.sap.BWReport, codjkaekngoeniemidleobclomgncaib -->
  47.  
  48. <script>
  49. <!--
  50.   function hasNestedFrameStructure() {
  51.     try {
  52.       return (parent != window) && (parent.EPCM != null);
  53.     } catch(e) {
  54.       return false; // access denied!
  55.     }
  56.   }
  57. //-->
  58. </script>
  59.  
  60. <!-- Session Mangement Check -->
  61.  
  62. <!-- HTTPRenderLayer_Redirect::Begin -->
  63. <form id="form_Redirect_9223372036563636042" 
  64.   name="form_Redirect_9223372036563636042"
  65.     method="POST"
  66.     target="_self"
  67.     action="/irj/servlet/prt/portal/prtroot/com.sap.ip.bi.web.portal.integration.launcher"
  68.     style="DISPLAY:none">
  69.       <input type="hidden" name="sap-bw-iViewID" value="pcd:portal_content/com.sap.pct/platform_add_ons/com.sap.ip.bi/iViews/com.sap.ip.bi.bex">
  70.       <input type="hidden" name="sap-ext-sid" value="H6enlztSkkUZX7G*QhdSKA--Jt2cQdvkBs_*9RVvQeGETA--">
  71.       <input type="hidden" name="Language" value="EN">
  72.       <input type="hidden" name="QUERY" value="ZPS_PMIS_R_006_01">
  73.       <input type="hidden" name="DUMMY" value="5">
  74.       <input type="hidden" name="VARIABLE_SCREEN" value="X">
  75.   </form>
  76. <div><iframe 
  77.     id="iframe_Redirect_9223372036563636042" name="iframe_Redirect_9223372036563636042"
  78.     title="BEx Web"
  79.     src="/irj/servlet/prt/portal/prtroot/com.sap.portal.appintegrator.Loading?1887930939"
  80.      width="100%" height="100%"
  81.     marginheight="0" border="0" frameborder="no">
  82.   </iframe></div>
  83.   <script> 
  84.     function requestTargetURL() {
  85.       var theForm = document.getElementById("form_Redirect_9223372036563636042");
  86.       var dsmObj;
  87.       if (hasNestedFrameStructure()) {
  88.         dsmObj = parent.EPCM.DSM;
  89.       } else {
  90.         document.body.scroll = "no"; // for IE only
  91.         theForm.target = "iframe_Redirect_9223372036563636042";
  92.         document.getElementById("iframe_Redirect_9223372036563636042").style.visibility = "visible";
  93.         dsmObj = EPCM.DSM;
  94.         document.title = 'BEx Web';    
  95.       }
  96.           dsmObj.registerFullKey("GUSID:H6enlztSkkUZX7G*QhdSKA--Jt2cQdvkBs_*9RVvQeGETA--", "1288161886180");
  97.       theForm.submit();
  98.     }
  99.  
  100.     function onloadhandler(){
  101.       setTimeout("requestTargetURL()",1);
  102.     }
  103. </script>
  104.  
  105.   <form id="form_ClientWindowID_9223372036563636042" name="form_ClientWindowID_9223372036563636042"
  106.     method="POST"
  107.     target="_self"
  108.     style="DISPLAY:none">
  109.     <!-- Request Parameters -->
  110.   <input type="hidden" name="VARIABLE_SCREEN" value="X">
  111.   <input type="hidden" name="ClientWindowID" value="null">
  112.   <input type="hidden" name="DUMMY" value="5">
  113.   <input type="hidden" name="QUERY" value="ZPS_PMIS_R_006_01">
  114.  
  115.     <input type="hidden" name="$Roundtrip" value="true">
  116.     <input type="hidden" name="$DebugAction" value="null">        
  117.   </form>
  118.   <script>
  119.     <!--
  120.     function submitClientWindowIDForm(formTarget, formAction) {
  121.  
  122.       // set ClientWindowID Form-Field
  123.       var theForm = setClientWindowIDForForm("form_ClientWindowID_9223372036563636042");
  124.  
  125.       // set Target
  126.       if (formTarget != "_self") {
  127.         theForm.target = formTarget;
  128.       }
  129.  
  130.       if (formAction != null && formAction.length > 0) {
  131.           theForm.action = formAction;
  132.       }
  133.  
  134.       // submit
  135.       theForm.submit();
  136.     }
  137.  
  138.     function setClientWindowIDForForm(formID) {
  139.       var windowID = EPCM.getUniqueWindowId();
  140.       var theForm = document.getElementById(formID);
  141.  
  142.       // add unique window ID to the form
  143.       if (theForm.ClientWindowID != null) {
  144.         theForm.ClientWindowID.value = windowID;
  145.       }
  146.  
  147.       return theForm;
  148.     }
  149.     //-->                   
  150.   </script>
  151.  
  152.  
  153.   <script>
  154.     <!-- 
  155.          var trueWindowID = EPCM.getUniqueWindowId();
  156.          if (trueWindowID != "null") {
  157.            submitClientWindowIDForm("_self");
  158.          } else {
  159.            EPCM.subscribeEvent("urn:com.sapportals.portal:browser","load",onloadhandler);
  160.          }
  161.     //-->
  162.   </script>
  163. <!-- HTTPRenderLayer_Redirect::End --></body></html>]  
  164.  

The javascript function which causing the issue

Expand|Select|Wrap|Line Numbers
  1. function hasNestedFrameStructure() {
  2.     try {
  3.       return (parent != window) && (parent.EPCM != null);
  4.     } catch(e) {
  5.       return false; // access denied!
  6.     }
  7.   }
  8.  
I have try onload event, It doesn't work.
The script inside the IFrame will run before onload event.
Oct 31 '10 #1
3 5237
acoder
16,027 Expert Mod 8TB
Can you change the source of the iframe?
Nov 1 '10 #2
Yes you can change source of the iframe.

I have found that this is not the issue for me.
The issue in the following code:

in the iframe page at line 155 there is call for
-- EPCM.getUniqueWindowId()
function which call
-- getSAPTop().
and the 'getSAPTop' function always return top. However, top shows access denied error.

Expand|Select|Wrap|Line Numbers
  1. EPCM.getUniqueWindowId=function(){
  2. var wid=null;
  3. try{
  4. wid=this.getSAPTop().name;
  5. var rewrite=true;
  6. if( wid != null && typeof(wid) == "string" ){
  7. if (wid.indexOf("WID") == 0) rewrite=false;
  8. if (wid.indexOf("DefaultExternal") == 0) rewrite=false;}
  9. if(rewrite){
  10. this.getSAPTop().name="WID"+(new Date()).getTime();}
  11. return this.getSAPTop().name;
  12. }catch (ex){
  13. return null;}
  14. }
  15. EPCM.getSAPTop=function(){
  16. return (this._private.isDynamicTop) ? this._private.refDynamicTop : top;}
  17.  
Nov 1 '10 #3
acoder
16,027 Expert Mod 8TB
OK, so the problem's elsewhere. Where is _private defined? Perhaps you could just replace the function with top?
Nov 2 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Torsten Mohr | last post by:
Hi, is there some description available to overwrite the import hook? By googling i found out so far that i need to overwrite __builtins__.__import__ with something else. Can i also do this...
3
by: David Baumgarten | last post by:
I am trying to download a file from a ftp server and if the file already exists to overwrite it. Here is my code: FtpGetFile(hConnection, "1.pdf", FLocation & "\Temp\" & "1.pdf", False, 1, 0,...
11
by: Florian Loitsch | last post by:
I'm currently writing a JS->Scheme compiler (which, using Bigloo, automatically yields a JS->C, JS->JVM, JS->.NET compiler), and have a question concerning the function-parameters: According to...
16
by: jhwagner | last post by:
I need to use double data entry with an MS Access database. I have read many arguments and reasons against this on this group but I have to do this. I have seen various tips on how this can be...
0
by: BlackCat_DNA_XY | last post by:
Hello, After switching from VC6 to .NET, I was looking for the class wizard to overwrite messages and functions and could not find where the option has been placed. Now, I found it, by looking...
10
by: lgbjr | last post by:
Hi All, In VB.Net how do I determine if CapsLock is on/off (same for NumLock) and whether the input mode is set to Insert or Overwrite (Insert Key). I just added a status bar to my app, and I...
3
by: Kai Kuehne | last post by:
Hi list! It is possible to overwrite only one function with the property-function? x = property(getx, setx, delx, 'doc') I just want to overwrite setx, but when I set the others to None, I...
2
by: hzgt9b | last post by:
I know how to overwrite a function. Normally this is what I would do: function someFunction() { /* orig definition here */ } //later in the execution stream I would do... someFunction = function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.