Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Can I change dynamically a dropdownbox's selectedIndex in a BexWebtemplate?

I'm coding directly <SELECT>tags in the HTML source for choosing a filter value by using JavaScript.

But there is a problem regarding the displaying of <SELECT>tag.

We want to see the dropdownlist with the correct selectedIndex value which we have selected.

So I've coded as the following.

When I call this report,the SetSelectedIdx() function doesn't work well.

It always sets '0' to the selectedIndex' value.

Is it possible to set the selectedIndex's value according to the innerHTML?

Would you give me any advice about this?

Best Regards,

Yosuke

<<<<The begin of the Code Sample>>>>

**********Our JavaScript**********

//Function:Set Filter value//

function Set_filter(){

fil_var=document.myForm.mySelect.options[document.myForm.mySelect.selectedIndex].value;

url=SAP_BW_URL_Get() + fil_var;

if (fil_var != "" )

SAPBWOpenURL(url);

}

//Function:Set selectedIndex's value to <SELECT>tag//

function SetSelectedIdx(){

fil_num=document.getElementById("mySelectedVar").innerHTML;

if(fil_num=="11111111"){

document.forms["myForm"].elements["mySelect"].options[1].selected = true;

}else

if(fil_num=="11111112"){

document.forms["myForm"].elements["mySelect"].options[2].selected = true;

}else{

document.forms["myForm"].elements["mySelect"].options[0].selected = true;

}

}

**********HTML Source**********

<BODY topmargin="0" bottommargin="10" onLoad="SetSelectedIdx()">

|

OMISSION

|

<FORM name="myForm">

<TD>

<SELECT name="mySelect" onChange="Set_filter()">

<OPTION value="<SAP_BW_URL DATA_PROVIDER='*' MULTI='X' FILTER_IOBJNM='0GL_ACCOUNT' FILTER_VALUE='!ALL'>">(all)

<OPTION value="<SAP_BW_URL DATA_PROVIDER='*' MULTI='X' FILTER_IOBJNM='0GL_ACCOUNT' FILTER_VALUE='11111111'>

">value1

<OPTION value="<SAP_BW_URL DATA_PROVIDER='*' MULTI='X' FILTER_IOBJNM='0GL_ACCOUNT' FILTER_VALUE='11111112'>">Value2

</SELECT>

</TD>

</FORM>

|

OMISSION

|

<P id='mySelectedVar'>

<object>

<param name="OWNER" value="SAP_BW"/>

<param name="CMD" value="GET_ITEM"/>

<param name="NAME" value="FILTER_2"/>

<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_FILTER"/>

<param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>

<param name="GENERATE_CAPTION" value=""/>

<param name="PRESENTATION" value="KEY"/>

<param name="ITEM_FILTER_IOBJNM_1" value="0GL_ACCOUNT"/>

<param name="PRESENTATION_1" value="KEY"/>

<param name="ONLY_VALUES" value="X"/>

ITEM: FILTER_2

</object>

</P>

|

<<<<The End of the Code Sample>>>>

Former Member
Not what you were looking for? View more on this topic or Ask a question