Skip to Content
0
Former Member
Oct 17, 2005 at 11:49 AM

Multiple BPS variables in Bex web report

38 Views

Hi Guys,

I am trying to have a Bex report use the BPS variables in the web interface. I have managed to do so with 1 variable, but we have a number of variables.

I have created the code below to get the result. however this doesn't seem to work.

Can anyone help me with this issue.

Gert van de Vreede

<iframe

id ="Z_WA_BPS_GRSALPR001"

src="/sap/bw/BEx?cmd=ldoc&TEMPLATE_ID=Z_WA_BPS_GRSALPR001"

style="width:1200;height:300">>

</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( 'Z_WA_BPS_GRSALPR001' );

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

var queryVar1 = '&VAR_NAME_1=0SALESORG&VAR_VALUE_EXT_1=';

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

var queryVar3 = '&VAR_NAME_3=ZZBRAND&VAR_VALUE_EXT_3=';

var queryVar4 = '&VAR_NAME_4=ZZLINE&VAR_VALUE_EXT_4=';

var queryVar5 = '&VAR_NAME_5=ZCOREC&VAR_VALUE_EXT_5=';

var queryVar6 = '&VAR_NAME_6=ZSUBCAT&VAR_VALUE_EXT_6=';

var queryVar7 = '&VAR_NAME_7=ZZMARCAT&VAR_VALUE_EXT_7=';

var queryVar8 = '&VAR_NAME_8=0VERSION&VAR_VALUE_EXT_8=';

var appl = 'Z_WA_BPS_GRSALPR001';

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

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

var bpsVarvl3 = '<%=descr(Brand_var/value)%>';

var bpsVarvl4 = '<%=descr(Line_var/value)%>';

var bpsVarvl5 = '<%=descr(Core_cat_var/value)%>';

var bpsVarvl6 = '<%=descr(Sub_cat_var/value)%>';

var bpsVarvl7 = '<%=descr(marcat_var/value)%>';

var bpsVarvl8 = '<%=descr(VarvlSel7/value)%>';

bpsVarvl1 = varValueConvert(bpsVarvl1);

bpsVarvl2 = varValueConvert(bpsVarvl2);

bpsVarvl3 = varValueConvert(bpsVarvl3);

bpsVarvl4 = varValueConvert(bpsVarvl4);

bpsVarvl5 = varValueConvert(bpsVarvl5);

bpsVarvl6 = varValueConvert(bpsVarvl6);

bpsVarvl7 = varValueConvert(bpsVarvl7);

bpsVarvl8 = varValueConvert(bpsVarvl8);

// create URL

url = url + appl + 0SALESORG + bpsVarvl1 + ZZHOUSE + bpsVarvl2 + ZZBRAND + bpsVarvl3 + ZZLINE + bpsVarvl4 + ZCOREC + bpsVarvl5 + ZSUBCAT + bpsVarvl6 + ZZMARCAT + bpsVarvl7 + 0VERSION + bpsVarvl8;

// remove possible white spaces

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

// alert('Generated URL: ' + url);

// set source attribute of iframe to new URL

frame.src = url;

</script>