cancel
Showing results for 
Search instead for 
Did you mean: 

highlighting entire row

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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");

Former Member
0 Kudos

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

Former Member
0 Kudos

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 .

Former Member
0 Kudos

Abraham,

Please give me some time. I'll get abck to you in about 30 minutes.

Thanks

Gova

Former Member
0 Kudos

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

Former Member
0 Kudos

and what is this "tr , td, table " iin the following statement shoule i change them with any thing as per my code

var rows = tbl.getElementsByTagName("tr");

var cols = tr.getElementsByTagName("td");

var all_tables = document.getElementsByTagName("table");

Former Member
0 Kudos

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

Former Member
0 Kudos

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>&nbsp;</P>

<P>&nbsp;</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<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

Former Member
0 Kudos

HI Gova,

Is there any problem in the above code , waiting for ur reply.

Thanks,

Abraham

Former Member
0 Kudos

Abraham,

please give me some time. I'll get back to you.

Gova

Former Member
0 Kudos

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>

Former Member
0 Kudos

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.

Former Member
0 Kudos

Abraham,

Now I get it... SDN is the culprit... When ever I am using 'square brackets' in the code, SDN Is removing them automatically and I didnt notice that until now.

send me your email ID and I'll mail it there.

Gova

Former Member
0 Kudos

Hi Gova ,

i got ur code in my mail , i tried it , it was not working ,any way i am once again giving my mail id is abhiramogili@gmail.com

Regards,

Abraham

Former Member
0 Kudos

HI Gova,

It solved my probelm thanks very much .

Regards,

Abhi

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Shamscharma
Participant
0 Kudos

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?

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

Former Member
0 Kudos

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