Colored rows

Hi!
Do you tell me a easy way to change a row color in report, when a column table have a
specific value?
Thanks

It's sometlhing like that :
Paul,
One way of doing this would be using named column report templates. Then you could define the background color in your query, and use the value in your row template, for example:
select ename, job, sal, comm, decode(deptno, 10, 'RED', 20, 'BLUE', 30, 'GREEN') bgcolor
from emp
<tr style="background:#5#"><td>#1#</td><td>#2#</td><td>#3#</td><td>#4#</td></tr>
Hope this helps,
Regards,
Marc
But, i don't know where insert the html code...

Similar Messages

  • Coloring row problem of JTable

    Hi!
    I'm the beginer and have a problem while coloring rows in my table. The problem is as follows:
    i need to color the whole row when i click a single cell of this row. Everything is ok until i click another cell of another row. When i do it all the row between first and last clicked become colored!
    I tryed manipulating table.setSelectionMode(i) - but nothing!
    My very simple code:
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer()
                public Component getTableCellRendererComponent(JTable table,Object value, boolean isSelected, boolean hasFocus, int row, int column)
                    Component cell = super.getTableCellRendererComponent(table,value, isSelected, hasFocus, row, column);
                    if (isSelected) {cell.setBackground(Color.LIGHT_GRAY);return cell;}
                    return cell;
    for(int i=0; i<table.getColumnCount(); i++)
                table.getColumnModel().getColumn(i).setCellRenderer(renderer);
    Please help!
    PS I cant use Ctrl button in my program because all the changes in table are in table.isEnable(false)-mode-it is the condition of my work.

    Karl already gave the correct answer: once you touched any Color property of a DefaultTableCellRenderer, you have to do it always, that is in any of the logic branches. That's because DTCR has a nasty color "memory" which basically is the net result of inapproriate subclassing (no compelling reason for a renderer to-be a component) and frozen api (couldn't add a setRendererXXColor) at the particular moment of evolution when it was needed. (Our SwingX wiki about swingx renderer/highlighter support has more details)
    BTW, if I interpret your code snippet correctly, you are after a different selection color for all columns? If so you can set that color globally for your table instance (hint: api doc is your friend :-), no need for a custom renderer.
    HTH
    Jeanette

  • Creating vertical reports with alternating colored rows

    I wanted to create a vertical report with alternating colored rows. Creating a vertical report template was not a problem but I am not able to use different bgcolor for alternating rows.

    As I mentioned above, I used the follwoing code to generate the vertical report BUT i could not get the alternating rows in a diffrent color:
    Before Rows:
    <table class="default2">
    Before Each Row:
    OMIT
    Column Template 1
    <tr><td bgcolor="#CCCC99" width="200"><font color="#336699" #ALIGNMENT#><b> #COLUMN_HEADER#</td> <td width="500">#COLUMN_VALUE#</td></tr>
    Column Template 1 Condition
    Use for Odd rows
    Column Template 1
    <tr><td bgcolor="#CCCC99" width="200"><font color="#336699" #ALIGNMENT#><b> #COLUMN_HEADER#</td> <td bgcolor="#FFFFFF" width="500">#COLUMN_VALUE#</td></tr>
    Column Template 1 Condition
    Use for Even rows
    After Each Row
    OMIT
    After Rows
    </table>

  • How to color row in ALV report?

    hi
    I am creating an ALV report using factory method.
    my report is based on itab which contain 3 coulms, 1 column is ERROR_TYPE . how can i color all the rows which contain E in error_type ???
    thanks
    Ami

    TABLES:LFA1.
    SELECT-OPTIONS:LIFNR FOR LFA1-LIFNR.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    REGIO LIKE LFA1-REGIO,
    SORTL LIKE LFA1-SORTL,
    CFIELD(4) TYPE C,
    END OF ITAB.
    data:col(4).
    data:num value '1'.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE LIFNR
    IN LIFNR.
    LOOP AT ITAB.
    concatenate 'C' num '10' into col .
    ITAB-CFIELD = col.
    num = num + 1.
    if num = '8'.
    num = '1'.
    endif.
    MODIFY ITAB.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA:SORT TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    DATA:EVE TYPE SLIS_T_EVENT WITH HEADER LINE.
    LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'VENDORS DETAILS SCREEN'.
    LAYOUT-EDIT = 'X'.
    LAYOUT-info_fieldname = 'CFIELD'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    this is for coloring cols
    REPORT ZBHCOLOR_COLS.
    TABLES:LFA1.
    SELECT-OPTIONS:C_LIFNR FOR LFA1-LIFNR. " FOR GRID ONLY
    PARAMETERS:LIST RADIOBUTTON GROUP ALV DEFAULT 'X',
    GRID RADIOBUTTON GROUP ALV.
    DATA:BEGIN OF ITAB OCCURS 0,
    LIFNR LIKE LFA1-LIFNR,
    NAME1 LIKE LFA1-NAME1,
    LAND1 LIKE LFA1-LAND1,
    ORT01 LIKE LFA1-ORT01,
    SORTL LIKE LFA1-SORTL,
    REGIO LIKE LFA1-REGIO,
    COL TYPE LVC_T_SCOL,
    END OF ITAB.
    DATA:COLR TYPE LVC_S_SCOL.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB.
    LOOP AT ITAB.
    IF ITAB-LIFNR IN C_LIFNR.
    COLR-FNAME = 'NAME1'.
    COLR-COLOR-COL = '5'.
    COLR-COLOR-INT = '1'.
    COLR-COLOR-INV = '0'.
    COLR-NOKEYCOL = 'X'.
    APPEND COLR TO ITAB-COL.
    COLR-FNAME = 'LIFNR'.
    APPEND COLR TO ITAB-COL.
    MODIFY ITAB.
    ENDIF.
    ENDLOOP.
    TYPE-POOLS:SLIS.
    DATA:FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-ZEBRA = 'X'.
    layout-coltab_fieldname = 'COL'.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = FCAT.
    IF LIST = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ELSEIF GRID = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FCAT
    TABLES
    T_OUTTAB = ITAB.
    ENDIF.
    Reward points if useful.

  • How to create colored rows in an avl table?

    I am looking for a possibility, how to color a row if the attribute "KEY" of my context has the value 'GOAL'.
    I did following:
    1. creating a attribute CELL_DESIGN type WDUI_TABLE_CELL_DESING in my context.
    then i wrote following coding:
    DATA lo_nd_table TYPE REF TO if_wd_context_node.
    DATA lo_el_table TYPE REF TO if_wd_context_element.
    DATA lt_table TYPE wd_this->elements_search_data.
    DATA ls_table TYPE wd_this->element_search_data.
    lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_search_data ).
    *get element via lead selection
    lo_el_table = lo_nd_table->get_element( ).
    lo_nd_table->get_static_attributes_table(
    IMPORTING
    table = lt_table ).
    loop at lt_table into ls_table.
    if ls_table-NAME1 = 'GOAL2'.
    lo_el_table->set_attribute(
    name = `CELL_DESIGN`
    value = 'negative' ).
    elseif ls_table-name1 = 'GOAL'.
    lo_el_table->set_attribute(
    name = `CELL_DESIGN`
    value = 'positive' ).
    endif.
    endloop.

    Hello,
    See this: set color alv output cell abap webdynpro
    Regards.

  • Problem with coloring rows

    hi there,
    how can i get a single row in my jtable colored? i tried out some solutions that were postet here, but they do not work for me. my problem is, that all rows get the new color although i defined it only for one row. i post some code for better understanding and maybe debugging. my jtable consists of 28 rows and 32 colums and i ONLY want row number 18 getting colored pink. any advice are welcome.
    public Tabelle() {
              super("Stundenplan");
              datenmodell = new DatenModell();
              tabelle = new JTable(datenmodell);
              TableColumn column = new TableColumn();
              column = null;
              for (int i = 0; i < 32; i++) {
              column = tabelle.getColumnModel().getColumn(i);
              if (i == 0) {
              column.setPreferredWidth(100);
              column.setCellRenderer(new CenterRenderer());
              else {
              column.setPreferredWidth(50);
              column.setCellRenderer(new CenterRenderer());
              kopf.setBorder(BorderFactory.createEtchedBorder());
              tabellenBox.add(kopf);
              tabellenBox.add(tabelle.getTableHeader());
              tabellenBox.add(tabelle);
              tabellenPanel.add(tabellenBox);
              scrollpane = new JScrollPane(tabellenPanel);
              scrollpane.setPreferredSize(new Dimension(1100, 520));
              getContentPane().add(scrollpane);
    that is the constructor of the jframe. the following code is my custom cell renderer:
    class CenterRenderer extends DefaultTableCellRenderer {
         public Component getTableCellRendererComponent(JTable tab, Object val, boolean sel, boolean foc, int z4, int s4) {
              Component component = super.getTableCellRendererComponent(tab,val,sel,foc,z4,s4);
              ((JLabel)component).setHorizontalAlignment(SwingConstants.CENTER);
              if (z4 == 18) {
                   setBackground(Color.pink);
              return component;
    }

    yeah, i tried it, but then there is some strange behavior. first all rows are white, but if you select row number 18 (the pink one) it becomes pink. then if you select a cell in another column, all becomes white again until you select row number 18 again.
    thats not satisfying for me, so if you have a solution for that, please post it.
    thanks in advance.

  • Colored rows in Excel sheet

    Hi all,
    Following the tutorial "Exporting context data into Excel using the WD binary cache" I could export the contents of a webdynpro table to an Excel sheet.I would like to know whether there is any provision to change the color of rows in the generated excel sheet, based on some conditions.
    Thanks n regards
    Shyam.

    Hi Shyam,
    Check this Excel data formatting
    Best regards, Maksim Rashchynski.

  • Color Row In Report

    HI Friends
    I want t display Row With Colour like This Report
    [http://apex.oracle.com/pls/apex/f?p=267:5:|http://apex.oracle.com/pls/apex/f?p=267:5:]
    Thanks

    Hi,
    You need to edit your report template, though it is usually best to create a new template based on a copy of your existing one.
    1 - Go to Shared Components
    2 - Select Templates
    3 - Click Create
    4 - Select Report
    5 - Select "As a copy of an existing template" and click Next
    6 - Select the application to copy the template from and click Next
    7 - Select the theme to copy the template from and click Next
    8 - In the list of templates, find the one you want to copy. Change the name from "Copy of ..." and select Yes in the Copy column
    9 - Click the Copy Report Template button.
    10 - Once the template has been created, scroll down the list of templates to find it and click on the link in the Name column to edit it
    11 - In the Column Templates section you should see 4 sets of settings - Column Template 1, 2, 3 then 4
    12 - Depending on what template you have copied from 1 or more of these may contain settings. If they do, copy all three settings into the three settings below them - so Column Template 1 settings move to Column Template 2 settings and so on. But ensure that Column Template 1 still has a copy of the original settings in it
    13 - Now you can just edit Column Template 1 settings to add in your colour. What you change depends on what your template/theme is, but as an example, if the original template setting was:
    &lt;td #ALIGNMENT# headers="#COLUMN_HEADER#" class="t18data"&gt;#COLUMN_VALUE#&lt;/td&gt;you can change this to:
    &lt;td #ALIGNMENT# headers="#COLUMN_HEADER#" class="t18data" style="background-color:red;"&gt;#COLUMN_VALUE#&lt;/td&gt;14 - Now you have to enter details of how Apex is to identify which row needs to use this new template. This is done in the Condition and Expression settings and will depend on what the condition is. In my example page, the condition was that column 5 (the deptno column) is equal to 10. So, the Condition is "Use based on PL/SQL Expression" and the Expression is:
    '#5#' = '10'#5# represents column 5 and it is in quotes as the comparisons need to be done as strings. As long as column 5 contains '10', then the template will be used. If it contains anything else, the templates that you moved down to 2, 3 and/or 4 will be checked. You must, therefore, always ensure that each record will satisfy one of the conditions (it can match more than one, but only the first one found will be used)
    Andy

  • Color rows in table control

    Hi all,
    Does anyone know how I can color spesific lines in a table
    control?
    I've only been able to color columns.
    Thanx,
    Baruch.

    Hi
    Are you speaking about classical TABLE CONTROL? No ALV?
    In this case you should modify the attribute using the LOOP/ENDLOOP statament into LOOP/ENDLOOP of TC in PBO:
    PROCESS PBO.
    LOOP AT ...
       MODULE LOOP_SCREEN.
    ENDLOOP.
    PROCESS PAI.
    MODULE LOOP_SCREEN.
      IF ......
        LOOP AT SCREEN.
          SCREEN-INTENSIFIED = 1.
          MODIFY SCREEN.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
    If you're speaking about ALV:
    In your OUTPUT TABLE you need add a new field to manage the color:
    DATA: BEGIN OT T_OUTPUT OCCURS 0,
            TCOLOR TYPE SLIS_T_SPECIALCOL_ALV,
          END   OF T_OUTPUT.
    It needs to specify the field name in layout structure:
    IS_LAYOUT-coltab_fieldname = 'TCOLOR'.
    So while you're appending the record into T_OUTPUT you fill the structure TCOLOR too.
    These is a table where you need all fields (so the cells of a row) you want to change the color.
    DATA: WA_COLOR TYPE SLIS_SPECIALCOL_ALV.
    T_OUPUT-FIELD = ...........
    REFRESH T_OUTPUT-TCOLOR.
    WA_COLOR-FIELDNAME = <field name>
    WA_COLOR-COLOR-COL = <color number>.
    APPEND WA_COLOR TO T_OUTPUT-TCOLOR.
    This way is ok for classical ALV, if you're using OO ALV the way is the same but change the structure you have to use:
    IS_LAYOUT-CTAB_FNAME = 'TCOLOR'.
    Where TCOLOR is like LVC_T_SCOL
    Max

  • Color rows in ALV

    Hi,
    I want to color alternative rows in ALV when I dsiplay the ALV.
    How can I do this?
    Regards,
    Vishal.

    Hi Vishal
    Use the method set_design of interface IF_SALV_WD_TABLE_SETTINGS.
    pass the value '00' for alternating color.
    DATA : lr_table_settings TYPE REF TO if_salv_wd_table_settings.
    data:
        l_VALUE type ref to Cl_Salv_Wd_Config_Table.
      l_VALUE = l_ref_INTERFACECONTROLLER->Get_Model(
      lr_table_settings = l_value.
    lr_table_settings->set_design('00' ).
    Regards
    Naresh

  • Dynamic color color rows n't proper

    Hi all,
    above tablix red circle dynamic columns
    i am using :row background color :=IIf(rownumber("Tablix10") mod 2, "white","whiteSmoke")
    give any solutions
    thanks

    Hi Revathi,
    Please click the link below to see Alternating Group Colors and Alternating Row Colors:
    http://www.bidn.com/blogs/briankmcdonald/bidn-blog/717/alternating-group-colors-and-alternating-row-colors
    By the way, if you use matrix in your report, the RowNumber function in the Matrix is totally different with it in the table because you are always dealing with grouped data in a matrix. This expression only works fine whit table report. So if we want to have
    the alternative color in the matrix, we may use the Running Function.
    If the issue persists, please elaborate the structure of your report so that we can make further analysis and help you out.
    Regards,
    Charlie Liao

  • Export to Excel with colored row

    Hi,
    I'm developing a alv report in web dynpro. The first  requirement is to put traffic lights based on some criteria. This part has been done.
    2nd requirement is to export this alv report into excel sheet. If traffic light of the row is 'RED' then in excel sheet it will be colored 'RED', if row is green excel sheet row will be 'GREEN' etc.
    Thanks in advance for providing  me solution of above problem  I'm new to dynpro.
    Thanks in advance,
    Abhijit.

    Hi ,
        If you need cell formatting you must use the Excel XML format. Build a spreadsheet with the features you want and then choose save as XML from within Excel. Then look at the resulting file with a text editor to see how the XML format is built. This is what you need to duplicate in ABAP using Concatenations, the iXML library or XSLTs.
       OR you can go through this link and check if it can help you:
      link : http://www.****************/Tutorials/WebDynproABAP/Excel/Index.htm

  • Enabled/Disabled color row Datagrid

    Hi all,
    I extend class Datagrid to draw rows depending a value.
    package comp
         import flash.display.Sprite;
         import mx.controls.DataGrid;
         import mx.core.Application;
         public class DataGridEx extends DataGrid
              public var rowColorFunction:Function;
              public function DataGridEx()
                   super();
              override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
                   if ( rowColorFunction != null && dataProvider != null ){
                        var item:Object;
                        if (dataIndex < dataProvider.length){
                             item = dataProvider[dataIndex];               
                        if (item){
                             color = rowColorFunction(item,rowIndex,dataIndex,color);
                   super.drawRowBackground(s,rowIndex,y,height,color,dataIndex);
    In MXML i wrote this. My purpose is user could chosse if the rows are coloured or not.
              private function colorRow():void{               
                   if (colorRowByFile == false){
                        colorRowByFile = true;                    
                   if (colorRowByFile == true){
                        colorRowByFile = false;
    And finally the code of Datagrid and color:
    public function calcRowColor(item:Object, rowIndex:int, dataIndex:int, color:uint):uint
                     if(item.numFile == 1)
                        return 0x49FFAD;
                   if(item.numFile == 2)
                        return 0x33CCFF;
                   if(item.numFile == 3)
                        return 0xFFCC66;
                   if(item.numFile == 4)
                        return 0xFFFF99;
                   if(item.numFile == 5)
                        return 0xFF6633;
                   if(item.numFile == 6)
                        return 0xFFCCCC;
                   if(item.numFile == 7)
                        return 0x996600;
                   if(item.numFile == 8)
                        return 0xCCFF99;     
                   else return 0xFFFFFF;            
    <comp:DataGridEx id="dg_events" width="100%" height="100%"
    dataProvider="{eventList.eventCollection}"
    rowColorFunction="calcRowColor">
    <comp:columns>
    <mx:DataGridColumn headerText="Nombre de evento" width="150"
    dataField="name"/>
    <mx:DataGridColumn headerText="ID" width="40"
    dataField="eventId"/>
    <mx:DataGridColumn headerText="Propietario" width="120"
    dataField="owner"/>
    <mx:DataGridColumn headerText="Fecha" width="70"
    dataField="date"/>
    <mx:DataGridColumn headerText="Hora" width="55"
    dataField="time"/>
    <!-- <mx:DataGridColumn headerText="N. Parámetros" width="100"
    dataField="numParams"/> -->
    <mx:DataGridColumn headerText="Parámetros"
    labelFunction="eventList.getParams"/>
    <mx:DataGridColumn headerText="Archivo" width="40"
    dataField="numFile"/>
    </comp:columns>
    </comp:DataGridEx>
    The problem is:
    Initially the option are enabled so the rows are correctly coloured depending the value of column numFile. When user clicks to disabled colors, datagrid appears correct (with no color) but if we click again to recoloured row the datagrid still the same state (with no colour).
    I dont know the reason.
    Thanks in advanced.
    Lerogke
    PD: sorry for my english

    Does your override of drawRowBackground get called?  Maybe the DG doesn't think it is dirty.  There are APIs like invalidateList() that might help
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Apex 4 -- Standard, Alternating Row Colors row highlight broken

    template: 14. Standard, Alternating Row Colors in apex 4.0 appears to have it mouse-over row highlight colors reversed (except for the first row, which is not highlighted)
    when first displayed, the rows are displayed white/gray/white...
    mousing over the first row does nothing, mousing out does nothing
    mousing over the 2nd row does nothing, mouse out changes it to white
    mousing over the 3rd row does nothing, mouse out changes it to gray
    etc

    I noticed this behavior too, very annoying. Did someone found a way to fix the template ?

  • How to color Rows and Columns of BI Query

    Hi to all,
    I have created BI query in query designer, with 2 structures for rows and Columns.
    Now I need that certain rows can be colored orange and certain columns as green color.
    I knew that it can be done in Query designer, but slice and dice reporting can not be done, which I required in my report.
    Is there any way I can do in WAD.
    or any other way to do that.
    i shall be thankfull to you for this.
    Regards
    Pavneet Rana

    Hi Rana,
    You can do the coloring of KF values using the report designer tool.
    Check the below links
    http://help.sap.com/SAPhelp_nw70/helpdata/en/dd/cea14119eb9f09e10000000a155106/frameset.htm
    [Creating Formatted reports using BEx Report Designer|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00ae5173-6112-2d10-d78f-e7779d269f25?QuickLink=index&overridelayout=true]
    Regards
    KP

Maybe you are looking for

  • Crdb_dao.dll error on 64 bit Windows 2008 Server

    We are using VS2008 to develop enterprise solutions for our customers. We have recently had support calls from our customers installing our solution on 64 bit WIndows Server 2008 machines reporting errors when displaying embedded Crystal Reports. The

  • Event Handling - New Approach

    Hi, I have developed a BSP and implemented the way Brian described in the Apprach 3 of the weblog mentioned below. In the method of new class that handles the server event(method name is same as server event), How do I access the model instance that

  • Re: Need help recover the Satellite A100-522

    Dear All I have a notebook and when I turn on could not found operation system error apears. I wanted to revcovery, but when I want to do it preaze in the first step. Also I wanted to do installation with new XP but I cannot delete drive C and instal

  • Need to print an output on two printers simultaneously

    Hi All, We have a requirement to print a spool on 2 printers simultaneously. Can this be done?? Please respond. Regards, Sharadendu

  • Adding Standalone Database to Group using Fail Safe fails

    Background: Oracle: 10.2.0.4 OFS: 3.4.1 Have installed Oracle Fail Safe correctly without errors. Ran Verify Standalone Database get this result: 27 10:00:04 > FS-10345: Verification of standalone database MYDB completed successfully 28 10:00:04 FS-1