Dynamic color in cell of an SmartForm Table

Hi Experts,
How can i assign a color for a text in a cell (shading) in a smartform table?? Color depends of the data in smartform.
Thanx

I don't think we can do it dynamically.
So, may be you have to create as many texts as you have colors conditions and assign relevent condition to each text.
Regards,
Naimesh Patel

Similar Messages

  • Problem in color a cell for field symbol table.

    Hi guru's
    when i'm trying to color a cell based on condition, getting the following error.
    ERROR:   the data object  <line> has no structure and therefore no component called  "cell_colour" .
    providing my code here:
    DATA: wa_cellcolor TYPE lvc_s_scol,
             lv_index     TYPE sy-tabix.
       break satishkumarc.
       LOOP AT <table> ASSIGNING <line>.
         lv_index = sy-tabix.
         ASSIGN COMPONENT 'COMPLIANCE' OF STRUCTURE <line> TO <field>.
         IF <field> EQ 'YES'.
           wa_cellcolor-fname     = 'COMPLIANCE'.
           wa_cellcolor-color-col = col_positive.
           wa_cellcolor-color-int = 0.
           wa_cellcolor-color-inv = 0.
         ELSE.
           wa_cellcolor-fname     = 'COMPLIANCE'.
           wa_cellcolor-color-col = col_negative.
           wa_cellcolor-color-int = 0.
           wa_cellcolor-color-inv = 0.
         ENDIF.
         APPEND wa_cellcolor TO <line>-cell_colour.                                                     "   error line
         MODIFY <table> FROM <line>  INDEX lv_index TRANSPORTING cell_colour.      "  error line
         CLEAR: wa_cellcolor.
       ENDLOOP.
    actually i know  that  <line>-cell_colour  won't work. but i don't know how to achive this functionality .
    could anybody please help me out in this.
    Thanks in Advance.
    regards
    satish
    thank

    hi ashish,
    i'm using
    field-symbols: <line> type any.
    CREATE DATA  mydata  LIKE LINE OF <table>.
           ASSIGN mydata->* TO <line>.
    to make the structure. so i guess i cannot give the structure name while declaring <line>.
    Thanks & regards
    satish

  • Dynamically coloring a cell based on user action.

    Dear Gurus,
    I know that many a questions have been posted based on cell coloring. But sadly i couldn't find anything that suits my requirement. My requirement is like i want to color a cell when the user double clicks on that cell. I have captured the double click event and iam filling the required color in a field in final itab (name : color). After this iam calling refresh_table_display.
    But sadly no changes are visible. Any help would be greatly appreciated.
    Given below the code.
    gfl_color-fname = l_fname-fieldname.
              gfl_color-color-col = '6' .
              gfl_color-color-inv = '1'.
              APPEND gfl_color TO gfl_rfinal-color.
              MODIFY git_rfinal FROM gfl_rfinal INDEX l_index-row_id
                                                TRANSPORTING color.
              CLEAR gfl_rfinal.
              CALL METHOD r_grid1->refresh_table_display
                EXCEPTIONS
                  finished = 1
                  OTHERS   = 2.
    Thanks and Regards,
    Sandeep Sivan
    Edited by: sandeep sivan on Aug 5, 2010 10:51 AM
    Edited by: sandeep sivan on Aug 5, 2010 11:01 AM

    Issue Solved.

  • Dynamically change the cell editor in the table control

    Hi..
         I have 3 columns in a table . of which in one column we need to change the cell editor dynamically at runtime.
    i.e for example i have  columns as carrid, connid and fldate.
    For the first 2 rows the cell editor for the carrid  clomn shud be a dropdown and from there on in the next rows for the same  carrid column it shud be a input field.
    Can experts plz help me how to achieve this as this is very high priority issue....
    Regards,
    Madhu...

    This is actaully fairly simple to do.  You will need to add a cellVariant to your table column. You can then dataBind a context attribute to the selectedCellVariant property of the column to control which cellVariant will be used. This allows you to control row-by-row which cell editor you want to output.
    http://help.sap.com/saphelp_nw70/helpdata/EN/bd/5d9041d3c72e7be10000000a1550b0/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/EN/56/5e9041d3c72e7be10000000a1550b0/frameset.htm
    Also here is an example that I did the other day that uses Cell Variants within ALV.  This process is actually a little more complicated because you have to go through the ALV APIs.  To do this in a normal table is actually easier because you can create the cellVariant in the layout designer.
    Re: Freely-programmed value help for a single ALV cell

  • Dynamic Color for Workbook

    Hi Expert,
    by creating a colored workbook i notice the color was disappearing after the refresh.
    I decide to built a makro which can fix the color in each line.
    I done that manually.
    But i am looking for a makro which can dynamically color the cells.
    for example:
    1. Total sum--- > color red
    1.2 sub sum color yellow
    1.2.1 sub sum color grey
    I will not want to fix that, because if there is a change in  the result it can not match again.
    Thank for your help
    Gilo

    Banu / Gilo, i am going thru the same exercise. Our users wanted the TOP 15 customers, sub total and Overall total. We cannot achieve this in a query as a HTML page, so we decided to use precalculation server to broadcast as a workbook. I know we need to run the report in BEx and store the workbook and then do the broadcast. I want to know when we store it as a workbook can we write macro to get the Sub total and the overall total.
    Do u have any documentation or idea to achieve this. Once i get this i can play with formats and coloring.
    Thanks in advance.
    Anand

  • To color selected cells in dynamically created table in ALV.

    Hi,
           The requirement is to display a table (whose columns are dynamic) using ALV n to color few cells of the table based on some condition.
    For creating the table dynamically i have used the method cl_alv_table_create=>create_dynamic_table.
    Now for coloring the cells i tried to use the field EMPHASIZE .
    But when I try this method the whole column is getting colored.
    So any suggestions on how to color only particular cells.

    Hi,
    Try this one...
    DATA: gs_layout TYPE slis_layout_alv, "Define layout
    gt_color TYPE lvc_t_scol WITH HEADER LINE. "Define Internal Table for Cell Colouring
    Use below Sample Code after building a Field Catalog:
    gs_layout-coltab_fieldname = 'COLINFO'.
    " 'it' is the final internal table which contain positive & negative value of Field 'MENGE'
    LOOP AT it.
    REFRESH gt_color.
    CLEAR gt_color.
    IF it-menge GE 0.
    CLEAR gt_color.
    gt_color-fname = 'MENGE'.
    gt_color-color-col = cl_gui_resources=>list_col_positive.
    gt_color-color-int = 0.
    APPEND gt_color.
    ELSEIF it-menge LE 0.
    CLEAR gt_color.
    gt_color-fname = 'MENGE'.
    gt_color-color-col = cl_gui_resources=>list_col_negative.
    gt_color-color-int = 0.
    APPEND gt_color.
    ENDIF.
    it-colinfo[] = gt_color[].
    MODIFY it.
    ENDLOOP.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = g_repid
    is_layout = gs_layout
    it_fieldcat = ct_fieldcat
    i_save = 'A'
    TABLES
    t_outtab = it
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    Hope this solves your problem.
    Regards,
    Tarun

  • ADF -- Dynamic InlineStyle on cells of table based on specified conditions.

    Hi there!!
    I am trying to figure out Dynamic Inline Style on cells in ADF:
    Need to color a few columns for a particular row (don't wanna color the entire column--just want to color those cells in columns that matches the specified condition for that particular row, in MY CASE:- row: having Col-A ="BBB" column: having value>250 ).
    Col-A Col-B Col-C Col-D
    AAA 100 255 300
    BBB *255* *300* 100
    I want to color the cells in BOLD....
    My basic condition:- Col-A = 'BBB' and other col values >250
    Can anyone help me out with this???

    Hi,
    try as following
    <af:inputText contentStyle=#{row.bindings.Col-A.inputValue eq 'BBB' and (row.bindings.Col-B.inputValue gt 250 or row.bindings.Col-C.inputValue gt 250 or row.bindings.Col-D.inputValue gt 250) ? 'font-weight:bold;':''}"/>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Dynamic Creation of cells or change of cell behaviour of a table at runtime

    Hello all,
    Can anybody tell me how can we change the cell behaviour of a table at runtime or creating the table row with different cell properties dynamically at runtime in ABAP webdynpro.
    for ex the table at runtime can be like...
    The 1st row the 1st cell can be a check box.
    The 2nd row the 1st cell can be a input field.
    The 3rd row the 1st cell can be a radio selection field.
    Business Ex : Dynamic Attributes in BID Invitation
    Thanks in advance in clarifying the doubt.

    Hi Mani,
    You could use code similar to the following code in your WDDOMODIFY method of the view in which the table is placed.
    data wd_table_cell_editor type ref to cl_Wd_view_element.
      data wd_table_column      type ref to cl_wd_table_column.
    wd_table_cell_editor ?= view->get_element( ID ). (Or any other way to get the refernce to the table cell editor)
    wd_table_column ?= wd_table_cell_editor->get__parent( ).
    (Get a refernce to table column throught table cell editor or directly)
    Now use the set_cell_editor method of wd_table_column to set the column to check box or input or any other field of your requirement.
    Also, I suggest you to use ALV as it is simpler change the cell editor and it provides many other improved functionalities.
    Regards,
    Srini.

  • Dynamic setting of cell attributes in Table Controls

    Hi everybody,
    I would like to set dynamicly wheather a cell or a line in a Table Control is only for output or ready for input.
    I know how it works with columns, but nothing is said about cells or lines.
    Thanx for clues.
    Greets
    Olaf

    Hi Olaf,
    Basically this works the same for all fields. However for table controls you should do the 'LOOP AT SCREEN' (within routine modify_screen_line in the example code) within the LOOP/ENDLOOP over your table control:
      LOOP AT   g_tc_itab
           INTO g_tc_wa
           WITH CONTROL tc_delivplant
           CURSOR tc_delivplant-current_line.
        MODULE modify_screen_line.
      ENDLOOP.
    Regards,
    John.

  • How to export table data with coloring of cell according to value.

    Hi all,
    I am using jdeveloper 11.1.1.6
    i want to export table data with lot of formatting. like with coloring of cell according to value and so many.How to do that?

    Hi,
    like with coloring of cell according to value and so many.How to do that?
    Answer is, you can't
    Frank

  • Smartform - tables

    Hi Friends..
    I need information about smartform tables, how to draw tables in smartform and display the data inside the tables.
    Thanks in advance
    gowrishankar

    hi gowrishankar,
    if u want to dispaly data item wise than u should use table....when data varies dynamically u should use tables....
    in this u need to define cells under table tab in that goto details...
    in data tab u will have to loop on internal table...
    and in pattern u will have select the patterns...
    for that table...
    hope this will help u out...
    please reward points in case usefull...
    regards,
    prashant

  • How do I change the background color of a row in a table indicator?

    Hello,
      How do I change the background color of a row in a table indicator? I know how to change the background color in a active cell, but that is not what I want. My first intent is to make the background color of the first row a unique color, such as green, just to highlight the top row of the table.
    Regards,
    Kaspar
    Regards,
    Kaspar

    I have done this before by using a for loop to change the active cell of a row in order to give the appearance that the whole row is turning the color at once.
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • Dynamically color to each column in Cross-tab report

    Hello All,
    I am a newbie in Crystal report,from last few weeks, i am working on cross tab crystal report.i have a requirement to show color dynamically for each column.i am adding an attachment how i want it. i tried dynamic coloring using object field formula but it is showing red color to all data.i want red color data when in 2nd  cross tab report data is beyond upper or lower limit in first cross tab table. it will be very helpful if somebody will give me any clue on this.... i read so many articles now it seem like impossible for me..:(
    i am using visual studio 2010 and sap crystal report version 13.0.0.99 for visual studio 2010.

    Hello Manish,
    I have attached a sample report that does this. You will need to remove the .txt extension from the attached file to open it as an .rpt file.
    Please right click on one of the value fields of the first cross tab in the report > Format Field > Common > Suppress if Duplicated conditional formula.
    The nested formula is as follows;
    numbervar array l;
    numbervar array u;
    numbervar x:=CurrentColumnIndex;
    if GridRowColumnValue ('@limit') = 'lower limit' then
    (redim preserve l[x];
    l[x]:= tonumber(CurrentFieldValue))
    else if GridRowColumnValue ('@limit') = 'upper limit' then
    (redim preserve u[x];
    u[x]:= tonumber(CurrentFieldValue));
    false
    So it assigns each lower and upper limit value for each client (in the sample it is country) to an array using the cross tabs column index to index the array and it ends in False as we don't actually want it to suppress if duplicated. This nested formula is just used to generate the arrays of upper and lower values.
    In the second cross tab if you again right click on one of the value fields > Format Field > Font > Color you will see the following conditional formula;
    numbervar array l;
    numbervar array u;
    numbervar x;
    if not(tonumber(CurrentFieldValue) in l[CurrentColumnIndex] to u[CurrentColumnIndex]) then
    crred
    else
    crblack
    So this compaes the current field value to range generated by the 2 arrays and assigns a color based on whether or not it is in the range.
    Regards,
    Graham

  • To color a specific row in a Table UI element

    Hello Experts,
    We have a requirement to highlight (with distinguish color) a specific row of a table UI based on column data.
    Suppose we have a table with 5 column and 10 row, now if the data on 5th column greater than some XYZ value then we need to highlight the specific row with a different color.
    Can anyone please help me to achieve this requirement?
    Thanks & Regards,
    Sambaran Chakraborty

    Hi,
    In your outline, I am missing quite a few prerequisites which I mentioned (not sure if you have implemented them already)
    your sub node, does it have singleton=false, cardinality 1..1 and selection cardinality 1..1?
    The attribute of type TableCellDesign in that sub node, does it have the calculated property to true?
    If you've bound each table column's cellDesign property to this calculated attribute, you just put some code in the generated generated get<SubNode><CalcAttribute> method to set the color
    For instance by just entering the line
    return WDTableCellDesign.CRITICALVALUE_LIGHT
    in that method will render each linked cell to that color
    Not sure what else I can say to explain this, there's not much to code...

  • How to set dynamic color , based on xml element

    Hi,
    We have a requirement, where based on certain conditions, a cell will be shown in a specific color. We would like the coloir to be based on an XML element. The xml element will have values like '#FF00FF' etc..
    We tried using xsl attribute with the following syntax ,
    <xsl:attribute xdofo:ctx="block"name="color"><?stdcolor?></xsl:attribute><?end if?>
    where stdcolor is the xml element, but when we use this , this is giving a syntax error.
    Let us know, if this is possible or is there any other alternate way to do this.
    Regards,
    - Vasu -

    Hi Vasu,
    http://winrichman.blogspot.com/2008/09/how-to-set-dynamic-color-based-on-xml.html
    use the following :)
    <xsl:attribute xdofo:ctx="block" name="color" ><xsl:value-of select="stdcolor" /></xsl:attribute>
    TO get the colors you wanted , you can refer to
    http://www.w3schools.com/Html/html_colors.asp

Maybe you are looking for