This website is not affiliated with, sponsored by, or approved by SAP AG.

Javascript Function

Business Warehouse

Moderators: Snowy, thx4allthefish

Javascript Function

Postby danieltan82 » Mon Jun 20, 2011 9:37 pm

Hi SAP Experts,

I have following codes and does not working in the body onload. Please help. Thanks

function goto_tabX(tabname)
{
SAPBWOpenURL(SAP_BW_URL_Get()+'&item=TABLE_*&multi=X&hidden=X&cmd_1=item%3D'+tabname+'*%26hidden%3D %26multi%3DX');
}

<body onLoad=goto_tabX(TABLE_2)>

Regards
Daniel
danieltan82
 
Posts: 2
Joined: Sun Jun 12, 2011 9:29 am

Re: Javascript Function

Postby JohnLang » Thu Jul 21, 2011 6:34 am

Hi Daniel,

I'm not sure if you are referring to the actual HTML ONLOAD parameter or the SAPBWOpenURL function call itself.

(1) To test just the HTML ONLOAD parameter, try this code. It will display a popup alert box showing some text. If the popup appears when you load this in the web browser then you know for sure the issue is not the triggering of the goto_tabX function.
Code: Select all
<HTML>
<HEAD>
   <SCRIPT LANGUAGE="JavaScript">
   <!--
function goto_tabX(tabname) {
alert("SAPBWOpenURL(SAP_BW_URL_Get()+'&item=TABLE_*&multi=X&hidden=X&cmd_1=item%3D'+tabname+'*%26hidden%3D %26multi%3DX');");
}
   //-->
   </SCRIPT>
</HEAD>
<BODY ONLOAD="javascript:goto_tabX('TABLE_2');" >
</BODY>
</HTML>


(2) The call of the SAPBWOpenURL function appears to have invalid URL encoding. The space in "hidden%3D %26multi" will prematurely terminate the URL encoding of the named parameter "cmd_1". Try removing it. Like "hidden%3D%26multi".
A side question ... are you sure you want the wildcard asterisk for "tabname+'*%26hidden" as this will match "TABLE_2" and "TABLE_20"?
Code: Select all
<HTML>
<HEAD>
   <SCRIPT LANGUAGE="JavaScript">
   <!--
function goto_tabX(tabname) {
   SAPBWOpenURL(SAP_BW_URL_Get()+'&item=TABLE_*&multi=X&hidden=X&cmd_1=item%3D'+tabname+'%26hidden%3D%26multi%3DX');
}
   //-->
   </SCRIPT>
</HEAD>
<BODY ONLOAD="javascript:goto_tabX('TABLE_2');" >
</BODY>
</HTML>


(3) This is a handy quick reference link for URL encoding.
http://www.w3schools.com/tags/ref_urlencode.asp

Kind Regards,
John.
JohnLang
 
Posts: 16
Joined: Wed Jul 20, 2011 3:56 am
Location: Australia


Return to Business Warehouse

Who is online

Users browsing this forum: No registered users and 4 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.