on 04-18-2006 7:50 PM
We have a report showing CUSTOMER and EMPLOYER on X axis and SATISFACTION LEVEL , SUPPORT LEVEL on Y axis.
Now what we want is if the SATISFACTION LEVEL or SUPPORT LEVEL goes below 6 , we want the whole ROW highlighted with a colour , not that single cell . So, is there any way to achive this .
Regads,
Abraham
Abraham,
This can be acheived by custom Javascript enhancement in the Web template.
First create a web template for this query. Once you have that, between <head> .... </head> area, insert the following code. This code highlights all the keyfiures but not the characteristics. Hope this does the job...
<script type="text/javascript">
var table_name = "GR1Table";//make sure this is the name of your table web item
function analyzeTable(){
var tbl = getTableReference( table_name );
var rows = tbl.getElementsByTagName("tr");
for( var i=0;i<rows.length;i++ ){
if( rows<i>.innerHTML.indexOf("SAPBEXexcBad9") > -1 )
hiliteCells( rows<i>, "SAPBEXexcBad9" )
}//end for
}//end function
function hiliteCells( tr,className ){
var cols = tr.getElementsByTagName("td");
for( var i=0;i<cols.length;i++ )
cols<i>.className.indexOf("Data")>0?cols<i>.className=className:"" ;
}//end function
function getTableReference( table_name ){
var all_tables = document.getElementsByTagName("table");
for( var i=0;i<all_tables.length;i++ ){
if( all_tables<i>.name == table_name ) //we have found tbl
return all_tables<i>;
}//end for
return null;
}//end function
window.attachEvent("onload", analyzeTable );
</script>
<b>NOTE:</b> SAPBEXexcBad9 is for exception level BAD9, similarly for the other codes, whatever you use...
Good Luck
Gova
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Gova Mabbu,
Thanks for ur reply , i did what u said , i
var table_name = "ZBOOKING_TABLE";// This is my table name
and if( rows.innerHTML.indexOf("SAPBEXexcBad6") > -1 ) as 6 is the colour is selected in Exceprion and saved it and ran but i am not not getting any change in my result.
and what is this "tr , td, table " iin the following statement shoule i change them with any thing
var rows = tbl.getElementsByTagName("tr");
var cols = tr.getElementsByTagName("td");
var all_tables = document.getElementsByTagName("table");
Abraham,
Here are the different CSS class names for the exceptions
SAPBEXexcGood1 - Exception with priority good 1
SAPBEXexcGood2 - Exception with priority good 2
SAPBEXexcGood3 - Exception with priority good 3
SAPBEXexcCritical4 - Exception with priority critical 4
SAPBEXexcCritical5 - Exception with priority critical 5
SAPBEXexcCritical6 - Exception with priority critical 6
SAPBEXexcBad7 - Exception with priority bad 7
SAPBEXexcBad8 - Exception with priority bad 8
SAPBEXexcBad9 - Exception with priority bad 9
Please use "<b>SAPBEXexcCritical6</b>" in your case.
Good Luck
Gova
Hi Gova,
Thanks for that reply , these are the changes made as u told still i am not getting any change in the out put
<script type="text/javascript">
var table_name = "ZBOOKINGS_TEST";//make sure this is the name of your table web item
function analyzeTable(){
var tbl = getTableReference( table_name );
var rows = tbl.getElementsByTagName("tr");
for( var i=0;i<rows.length;i++ ){
if( rows.innerHTML.indexOf("SAPBEXexcCritical6") > -1 )
hiliteCells( rows, "SAPBEXexcCritical6" )
}//end for
}//end function
function hiliteCells( tr,className ){
var cols = tr.getElementsByTagName("td");
for( var i=0;i<cols.length;i++ )
cols.className.indexOf("Data")>0?cols.className=className:"" ;
}//end function
function getTableReference( table_name ){
var all_tables = document.getElementsByTagName("table");
for( var i=0;i<all_tables.length;i++ ){
if( all_tables.name == table_name ) //we have found tbl
return all_tables;
}//end for
return null;
}//end function
window.attachEvent("onload", analyzeTable );
</script>
are there any changes to it .
Abraham,
I do not see any error in the code. PLease check these.
1. Where are you including the code? Make sure it's in the header section. Between <head> .... </head>. Make sure you got the table name right.
2. So you are using the "Medium6" exception. Try using Bad9 and see if that makes any difference. (I have used it with both Medium6 and Bad9 and both work fine)
3. Please test the exception again. Is that working properly?
4. As I told you before, it'll only highlight the keyfigures but not the characteristics.
5. Do you have the same exception level, i.e. Medium6 on both the keyfigures? If you have different levels, you need to add code for the additional exception also.
PLease let me know
Gova
Araham,
You do not need to change any part of the code including the td, tr and table. It should work without any changes except those I mentioned already.
It is so obvious, but, Once you save the web template, are you executing the web template or executing directly from Query Designer?
can you send me the complete code of the web template.
Thanks
Gova
This is the entire code
<HTML>
<!-- BW data source object tags -->
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_DATA_PROVIDER"/>
<param name="NAME" value="ZBOOKINGS_DATAPROV"/>
<param name="QUERY" value="ZBOOKING_TEST"/>
<param name="INFOCUBE" value="Z_P_O005"/>
DATA_PROVIDER: ZBOOKINGS_DATAPROV
</object>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_PROPERTIES"/>
<param name="TEMPLATE_ID" value="ZBOOKINGS"/>
TEMPLATE PROPERTIES
</object>
<HEAD>
<script type="text/javascript">
var table_name = "ZBOOKINGS_TEST";//make sure this is the name of your table web item
function analyzeTable(){
var tbl = getTableReference( table_name );
var rows = tbl.getElementsByTagName("tr");
for( var i=0;i<rows.length;i++ ){
if( rows.innerHTML.indexOf("SAPBEXexcCritical6") > -1 )
hiliteCells( rows, "SAPBEXexcCritical6" )
}//end for
}//end function
function hiliteCells( tr,className ){
var cols = tr.getElementsByTagName("td");
for( var i=0;i<cols.length;i++ )
cols.className.indexOf("Data")>0?cols.className=className:"" ;
}//end function
function getTableReference( table_name ){
var all_tables = document.getElementsByTagName("table");
for( var i=0;i<all_tables.length;i++ ){
if( all_tables.name == table_name ) //we have found tbl
return all_tables;
}//end for
return null;
}//end function
window.attachEvent("onload", analyzeTable );
</script>
<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
<TITLE>BW Web Application</TITLE>
<link href="/sap/bw/Mime/BEx/StyleSheets/BWReports.css" type="text/css" rel="stylesheet"/>
</HEAD>
<BODY>
<P> </P>
<P> </P>
<P>
<B> I think this is not working properly </B>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="ZBOOKINGS_TEST"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>
<param name="DATA_PROVIDER" value="ZBOOKINGS_DATAPROV"/>
ITEM: ZBOOKINGS_TEST
</object></P>
</BODY>
</HTML>
is there any thing that i has to change
Abraham,
Here is the solution. There is a small error in the code... for all the funtion calls
,
I forgot to pass the <i> value. Copy the below code and paste it. It should work.
Good Luck
Gova
*****************************************************
<script type="text/javascript">
var table_name = "ZBOOKING_TABLE";//make sure this is the name of your table web item
function analyzeTable(){
var tbl = getTableReference( table_name );
var rows = tbl.getElementsByTagName("tr");
for( var i=0;i<rows.length;i++ ){
if( rows<i>.innerHTML.indexOf("SAPBEXexcCritical6") > -1 )
hiliteCells( rows<i>, "SAPBEXexcCritical6" )
}//end for
}//end function
function hiliteCells( tr,className ){
var cols = tr.getElementsByTagName("td");
for( var i=0;i<cols.length;i++ )
cols<i>.className.indexOf("Data")>0?cols<i>.className=className:"" ;
}//end function
function getTableReference( table_name ){
var all_tables = document.getElementsByTagName("table");
for( var i=0;i<all_tables.length;i++ ){
if( all_tables<i>.name == table_name ) //we have found tbl
return all_tables<i>;
}//end for
return null;
}//end function
window.attachEvent("onload", analyzeTable );
</script>
Hi Gova, i coped the code and ran the web report but it is not hilighting any other cells except the cell which i have the exceptions defined. , this is the code
<script type="text/javascript">
var table_name = "ZBOOKING_TEST";//make sure this is the name of your table web item
function analyzeTable(){
var tbl = getTableReference( table_name );
var rows = tbl.getElementsByTagName("tr");
for( var i=0;i<rows.length;i++ ){
if( rows<i>.innerHTML.indexOf("SAPBEXexcBad9") > -1 )
hiliteCells( rows<i>, "SAPBEXexcBad9" )
}//end for
}//end function
function hiliteCells( tr,className ){
var cols = tr.getElementsByTagName("td");
for( var i=0;i<cols.length;i++ )
cols<i>.className.indexOf("Data")>0?cols<i>.className=className:"" ;
}//end function
function getTableReference( table_name ){
var all_tables = document.getElementsByTagName("table");
for( var i=0;i<all_tables.length;i++ ){
if( all_tables<i>.name == table_name ) //we have found tbl
return all_tables<i>;
}//end for
return null;
}//end function
window.attachEvent("onload", analyzeTable );
</script>
i have Material in the rows and NETVALUE, NETPRICE in the coloumn , i cerated the exception9 on NETVALUE.
Hi Abraham/Gova,
I am trying to achieve the same thing, as discussed I applied the code between <HEAD></HEAD> , changed the table name to <Table_1>.
I have one column, Variance that need to highlight the amounts that have values passed by the exception varaiable exp1 from a URL and highlight the row.
Can you please suggest on how did you get it to work.
Thanks
Sarah,
What is the exception level that you are using? You need to use the appropriate object.
SAPBEXexcGood1 - Exception with priority good 1
SAPBEXexcGood2 - Exception with priority good 2
SAPBEXexcGood3 - Exception with priority good 3
SAPBEXexcCritical4 - Exception with priority critical 4
SAPBEXexcCritical5 - Exception with priority critical 5
SAPBEXexcCritical6 - Exception with priority critical 6
SAPBEXexcBad7 - Exception with priority bad 7
SAPBEXexcBad8 - Exception with priority bad 8
SAPBEXexcBad9 - Exception with priority bad 9
Good Luck. Let me know
Gova
Hello Gova/Abrahm
I am trying to achieve the same.
Highlight an entire row on a web report.
I was following the code supplied by Gova but it did not work.
I have set an exception Medium in my query.
I want to identify a text in a column or an amount and color/highlight a row.
Not much of a javascript guy. Need your help.
Thanks! Gova your code was helpful; You only had functions in the code; when do we call them?
Hi Gova,
Have you a solution in order to highlight the whole row (characteristic cells and key figure cells) for a value of a key figure ?
I try to highlight a line with exceptions on key figure but it apparently colors only key figures.
For example i would have :
field1:a field2:x field3:e key_figure:1
field1:b field2:x field3:e key_figure:7
field1:b field2:y field3:e key_figure:-5
field1:d field2:z field3:j key_figure:1
Thanks for help.
Hi Abraham,
If you are in Excel, you can use Visual Basic.
I think this question has been asked before and I am certain that the answer is "no".
- Pete
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.