cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple BPS variables in Bex web report

Former Member
0 Kudos

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>

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I had a similar problems. The causes & findings were

1. I had fiscal period and I did not pass fiscal year variant. In other words, for compounded characteristics, pass both the values.

2. I had some wrong assignments, Checked those by using alert url

3. There is a limitation on the size of url string, believe it is 200 or 250. Find out if you exceed the length.

Hope this helps

-NS

Former Member
0 Kudos

I think I am getting the wrong URL.

All values are concatenated.see:

CMD=LDOC&TEMPLATE_ID=Z_WA_BPS_GRSALPR0010SALESORGCN01ZZHOUSE10001 . do you know how the variables should look like in the url?

Gert

Former Member
0 Kudos

this how the url should be

/sap/bw/BEx?cmd=ldoc&TEMPLATE_ID=XXXXX&FILTER_IOBJNM_1=0COMPANY&FILTER_VALUE_EXT_1=999&FILTER_IOBJNM_2=0FISCYEAR&FILTER_VALUE_2=K42006

wherw XXXXX is your template id name

By the way, are you trying to use a <b>bex report</b> or a <b>bex app</b>?

Hope this helps

-NS

former_member93896
Active Contributor
0 Kudos

Hi Gert,

the following line is wrong:


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

Try this:


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

Regards

Marc

SAP NetWeaver RIG

Former Member
0 Kudos

Hi Marc,

I have tried the change, without success.

The BPS variables seem to be working as I get a popup for every variable with the correct value.

the value is not "picked up" in the BW report.

Regards

Gert