Skip to Content
0
Former Member
May 19, 2005 at 01:30 PM

Integrate BEx Web into BPS Web Interface - passing variable values

25 Views

Hello,

I am trying to implement a BEx Report into a BPS web interface and have followed the instructions in "How to Integrate BEx Web Applications into BPS Web Interfaces". I have 2 variable selections and 1 is fiscal year and the other version. When I implement the code in the appendix for 2 variables, the version works fine, but the fiscal year does not. I have tried to adapt the code to take into account that fiscal year is compounded based on the other example in the documentation, but to no avail. When I switch the fiscal year in the BPS variable, the BEx query does not change.

Below is the code. Can anyone tell me what I am doing wrong? It is very frustrating looking at the How To because the 2 examples vary significantly so I cannot incorporate each aspect (compounding and 2 variables) easily.

<iframe

id ="myWebAppl"

src="/sap/bw/BEx?cmd=ldoc&TEMPLATE_ID=0ADHOC&QUERY=ZLFQCDR_LDR"

style="width:900;height:800">>

</iframe>

<script language="JavaScript" type="text/javascript">

function varValueConvert(dispValue){

/* Expected formatting of variable selector: Text(Key) or Key

If there are more than one (...) expression the first is taken.

*/

var keySection = dispValue.match(/\(.*?\)/);

if (keySection){

var keyValue = keySection[0].replace(/\(|\)/g,"");

alert(dispValue + ' : ' + keySection + " : " +keyValue);

return keyValue;

} else {

alert(dispValue);

return dispValue;

}

}

var frame = document.getElementById( 'myWebAppl' );

var url = '/sap/bw/BEx?cmd=ldoc&VARIABLE_SCREEN=X&TEMPLATE_ID=';

var queryVar1 = '&VAR_NAME_1=ZFY_FY1&VAR_VALUE_EXT_1=';

var queryVar2 = '&VAR_NAME_2=ZFBGTV1A&VAR_VALUE_EXT_2=';

var appl = '0ADHOC&QUERY=ZLFQCDR_LDR';

var fiscvar = 'V9/';

var bpsVarvl1 = '<%=descr(ZFPMPCDR_ZFISCYR/value)%>';

var bpsVarvl2 = '<%=descr(ZFPMPCDR_ZVERSION/value)%>';

if (bpsVarvl1 != "" && bpsVarvl1 != "-- SELECT --"){

// expected formatting of variable selector: Text(Key) or Key

var convert = /\((.*)\)/;

convert.exec(bpsVarvl1);

// If there is value in brackets it is the key

if ( RegExp.$1 != "") bpsVarvl1 = RegExp.$1;

}

bpsVarvl2 = varValueConvert(bpsVarvl2);

// create URL

url = url + appl + queryVar1 + fiscvar + bpsVarvl1 + queryVar2 + bpsVarvl2 ;

// remove possible white spaces

url = url.replace(/ /,"");

alert('Generated URL: ' + url);

// set source attribute of iframe to new URL

frame.src = url;

</script>