ALV wrong (blank) Cell Color in Checkbox-Column

I have several columns with checkboxes in an ALV. (Editor = Checkbox)
The color is set with set_cell_design_fieldname( ).
Some of the cells are set to invisible with set_visible_fieldname(  )
For these cells the value for the cell design is cl_wd_abstr_master_table_col=>e_cell_design-standard.
Some of these (invisible) cells are displayed with white color.
Most of the cells are correctly displayed in light blue.
Service-Pack level is 15. (SAP_BASIS)
Thanks in advance
Bernhard

Valid values for Color are from 1 to 7. So in your Loop at IT_EKPO as you are assigning LD_Color with Sy-tabix value, the first 7 are getting different colors and the remaining 8,9,10 are getting default color as color value 8,9,10 are invalid. Check the below logic which would generate 1 to 7 for the sy-tabix value 1 to 10.
LOOP AT IT_EKPO into wa_ekpo.
LD_color = ( SY-TABIX - 1 ) mod 7 + 1.  " Returns 1 to 7 for different Sy-tabix values
WA_CELLCOLOR-FNAME = 'EBELN'.
WA_CELLCOLOR-COLOR-COL = LD_color.
WA_CELLCOLOR-COLOR-INT = '1'.
..... " Existing logic
ENDLOOP.

Similar Messages

  • ALV Grid display cell color based on value ( Function Module ALV )

    Hi,
    I want to color the cell based on value eg ( Green = Green color, Red = Red color, Amber = Yello color ).
    Each and every cell is editable after displaying on screen. once the user clicks update button the contents has to be saved to a custom table.
    Can anyone help?
    Advance thanks

    Hi,
    <li>To get color for the cell, you need to set EMPHASIZE field with below information while building fieldcatalog.
    emphasize (highlight columns in color)
    value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off '1'=on)
    'X' = column is colored with the default column highlight color.
    'Cxyz' = column is colored with a coded color:
    C: Color (coding must begin with C)
    x: color number
    y: bold
    z: inverse
    <li> To edit the fields, you need to set EDIT = 'X' or INPUT= 'X' . Try those .
    wa_fieldcata-input = 'X'.
    <li>you need to set PF status , to do your remaining requirement.
    <li>For any help, you have to search the forum .
    Thanks
    Venkat.O

  • Do sum in ALV based on the color of the column

    Hi ,
    I have one column in ALV which has color red or green based on the whether to consider it in summationn or not based on some condition. Now I want to do 'Total' of this column, but not all the values should be considered. Instead of that only those values which have color green should be considered. Whether it is possible by capturing the do sum event or something like that? If yes, Please tell me the steps
    Thanks in advance,
    Rgds,
    Madhuri

    Hi,
    Try this :
    IT_FIELDCAT-DATATYPE = 'CURR' .
    IT_FIELDCAT-CFIELDNAME = 'WAERS' " internal table field.
    IT_FIELDCAT-CTABNAME = 'IT_TAB'. " internal table name
    IT_FIELDCAT-FIELDNAME = 'NETPR'." internal table of nettpr field
    IT_FIELDCAT-DO_SUM = 'X'.
    Regards,
    Prashant

  • ALV - show blank cell if numeric value is zero

    Hi
    I have an ALV with serveral numeric and decimal fields.
    Is it possible without a lot of effort (like assigning a separate cell with the visibilty attribute for each cell) to hide the cell content if the value is zero instead of showing 0 or 0,00 and so on .
    Thanks
    Thomas

    >
    Thomas Jetzinger wrote:
    > Hi
    >
    > I have an ALV with serveral numeric and decimal fields.
    >
    > Is it possible without a lot of effort (like assigning a separate cell with the visibilty attribute for each cell) to hide the cell content if the value is zero instead of showing 0 or 0,00 and so on .
    >
    > Thanks
    > Thomas
    I have a feeling that a cell variant or dynamic manipulation of visibility is going to be the correct answer.  The data type rules will always fire for the conversion exit on output.  You could maybe create a custom domain with its onw conversion exit but I would think that would actually lead to more work than just using hte cell variant/visibility property.

  • Concatenate with Commas in Non-Blank Cells

    I am concatenating last and first name cells in a pair of long columns.  I do not want to display commas in the non-blank cells when extending the formula down the sheet.  On the web I found a formula which almost works:  =C7&IF(B7="","","
    "&B7) .
    But, I need to put a comma between the last and first names.  So, instead of "Smith Hal" it would read "Smith, Hal".  Please advise.
    PS, An alternative would be to delete the commas from blank cells in the concatenated column from earlier today.  But, Excel does not see them for some reason and will not allow me to replace them with nothing.  Is there a way to do this en masse?
    Thanks.
    Doug in York PA
    Douglas R. Eckert

    I stumbled upon the solution.  Here is my note to myself for future reference.
    COMMAS in CONCATENATE BUT NOT IN BLANK CELLS – FORMULA
    To concatenate a long column of names (last, first) without leaving extra commas in the blanks cells use the following formula: 
    =C7&IF(B7="","",", "&B7) .
    Please close this question.
    Thanks.
    Doug in York PA
    Douglas R. Eckert

  • Fill Blank Cells in Column

    I have a spreadsheet given to me that is a list. Column A is a nominal or catergorical variable (imagine something like "Nationality") and column B is a ratio variable (imagine something like "height").
    Unfortunately not all of the rows have data filled out column A. The issue is identical to the one presented here in MS Excel: http://www.contextures.com/xlDataEntry02.html
    I would like to calculate averages for the subgroups in column A. I could do this manually be selecting each range of data in column B, but with thousands of cells and many subcategories, it would take a long time. From what I can see Numbers "categories" function won't work as I would like if there are blank cells, so it seems I would need to fill in the blank data, to make a proper nominalised database list. Rather than do this manually with manual fills, is there a way to do it programatically? I can't manage the trick for MS Excel in the aforementioned website, as Numbers only allows filtering for blank cells, rather than selecting blank cells.
    I hope someone can help.

    And now, the script :
    --[SCRIPT fillblankcells]
    Enregistrer le script en tant que Script : fillblankcells.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner une cellule dans la colonne à compléter.
    menu Scripts > Numbers > fillblankcells
    Si une cellule de la colonne est vide, le script l'alimente avec le contenu de la dernière cellule remplie qui la précéde.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    --=====
    Save the script as a Script: fillblankcells.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select a cell in the column to fill.
    menu Scripts > Numbers > fillblankcells
    The script will fill every blank cell of this column with the contents of the preceeding filled cell.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2010/04/05
    --=====
    on run
    set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName to tell column colNum1
    set maybe to ""
    repeat with r from 2 to count of row
    if not (value of cell r) = 0 then
    set maybe to value of cell r
    else
    set value of cell r to maybe
    end if
    end repeat
    end tell
    end run
    --=====
    on getSelParams()
    local r_Name, t_Name, s_Name, d_Name, col_Num1, row_Num1, col_Num2, row_Num2
    set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
    if r_Name is missing value then
    if my parleAnglais() then
    error "No selected cells"
    else
    error "Il n'y a pas de cellule sélectionnée !"
    end if
    end if
    set two_Names to my decoupe(r_Name, ":")
    set {row_Num1, col_Num1} to my decipher(item 1 of two_Names, d_Name, s_Name, t_Name)
    if item 2 of two_Names = item 1 of two_Names then
    set {row_Num2, col_Num2} to {row_Num1, col_Num1}
    else
    set {row_Num2, col_Num2} to my decipher(item 2 of two_Names, d_Name, s_Name, t_Name)
    end if
    return {d_Name, s_Name, t_Name, r_Name, row_Num1, col_Num1, row_Num2, col_Num2}
    end getSelParams
    --=====
    set {rowNumber, columnNumber} to my decipher(cellRef,docName,sheetName,tableName)
    apply to named row or named column !
    on decipher(n, d, s, t)
    tell application "Numbers" to tell document d to tell sheet s to tell table t to return {address of row of cell n, address of column of cell n}
    end decipher
    --=====
    set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errmsg, errNum
    tell application "Numbers" to tell document 1
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    try
    (selection range of table y) as text
    on error errmsg number errNum
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errmsg, quote)
    return {theDoc, theSheet, theTable, theRange}
    end try
    end repeat -- y
    end if -- x>0
    end tell -- sheet
    end repeat -- i
    end tell -- document
    return {missing value, missing value, missing value, missing value}
    end getSelection
    --=====
    on decoupe(t, d)
    local l
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to ""
    return l
    end decoupe
    --=====
    on parleAnglais()
    local z
    try
    tell application "Numbers" to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) lundi 5 avril 2010 14:37:02

  • Setting cell color in ALV

    Hi All
    I would be greatful if someone could please help...
    I am still attempting to get cells painted within a WDA ALV grid display.
    I have tried to use the method stated in the WDA sap press book - but this method is for use with TABLE element and I am using a ViewContainerUIElement for my table. There are mentions of wonderful ways to color cells in a list display - but I cannot understand how this can be achieved. I currently have this working appart from the numeric numbers of the design being set into the relavant column cell.
    If anyone could help that would be great...
    Please see: http://picasaweb.google.co.uk/dave.alexander69/Pictures#5244800978549492338
       LOOP AT lt_zdata INTO ls_zdata.
            lv_index = sy-tabix.
    *       set column values
    *       loop at row data and set colour attributes of individual cells
            LOOP AT lt_columns ASSIGNING <fs_column>.
              lr_col_header = <fs_column>-r_column->get_header( ).
              lr_col_header->set_ddic_binding_field( ).
              CREATE OBJECT lr_input_field EXPORTING value_fieldname = <fs_column>-id.
              lr_column = lr_column_settings->get_column( <fs_column>-id ).
    *         for the date columns only...
              IF <fs_column>-id(4) = 'CELL'.
    *           get and set column dates from select option user input
                READ TABLE lt_dates INTO ls_dates INDEX 1.
                IF lt_dates IS INITIAL.
                  lr_col_header->set_text( 'Date' ).
                ELSE.
                  ls_dates-low = ls_dates-low + lv_incr_date.
                  MOVE ls_dates-low+2(2) TO lv_for_col_date+6(2).   "Year
                  MOVE ls_dates-low+4(2) TO lv_for_col_date+3(2).   "Month
                  MOVE ls_dates-low+6(2) TO lv_for_col_date(2).     "Day
                  MOVE lv_for_col_date   TO lv_col_date.
                  lr_col_header->set_text( lv_col_date ).
                  lv_incr_date = lv_incr_date + 7.
                ENDIF.
                LOOP AT lt_orgdata_dates INTO ls_orgdata_dates
                  WHERE crew = ls_zdata-crew
                    AND position = ls_zdata-position
                    AND name = ls_zdata-person
                    AND trip_arr >= ls_dates-low
                    AND trip_dep <= ls_dates-low.
    *             column heading settings
                  lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
                  lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
    * trying to set cell variants ?@#??!!???
    *              lr_cv = lr_column->set_key( ls_zdata-variance ).
    *              lr_cv->set_editor( lr_input_field ).
    *              lr_cv->set_cell_design( value = '01').
    *              lr_column->add_cell_variant( lr_cv ).
    * current method of seeting the cell colors... (but puts value in cell!)
                  FIELD-SYMBOLS: <fs> TYPE data.
                  lr_column->set_cell_design_fieldname( value = <fs_column>-id ).
                  ASSIGN COMPONENT <fs_column>-id OF STRUCTURE ls_zdata TO <fs>.
                  WRITE: CL_WD_TABLE_COLUMN=>e_cell_design-one TO <fs>.
                  MODIFY lt_zdata FROM ls_zdata. " INDEX lv_index.
                ENDLOOP.
              ENDIF.
    Kind Regards
    Dave Alexander

    Hi check this code to set cell colors for ALV grid.
    Take a context attribute with type WDUI_TABLE_CELL_DESIGN.
    Here i am populating colors based on some condition.Check the loop of the internal table.
    method get_flight_details .
    data:node_flights type ref to if_wd_context_node,
         it_flights type sflight_tab1,
         ls_flights type sflight,
         it_final type   if_componentcontroller=>elements_flights,
         ls_final type   if_componentcontroller=>element_flights.
        select * from sflight into table it_flights
    up to 100 rows.
        node_flights = wd_context->get_child_node( 'FLIGHTS' ).
        loop at it_flights into ls_flights.
           move-corresponding ls_flights to ls_final.
           if ls_final-price = '185.00'.
              ls_final-readonly = abap_true.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-badvalue_light.
           else.
              ls_final-readonly = ' '.
              ls_final-celldesign =
    cl_wd_table_column=>e_cell_design-goodvalue_light.
           endif.
           append ls_final to it_final.
        endloop.
        node_flights->bind_table(
            new_items            = it_final
            set_initial_elements = abap_true
    *        INDEX                = INDEX
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
    l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
    if l_ref_cmp_usage->has_active_component( ) is initial.
       l_ref_cmp_usage->create_component( ).
    endif.
    data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
    l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
       data:
         l_value type ref to cl_salv_wd_config_table.
       l_value = l_ref_interfacecontroller->get_model(
    * Make Price column editable
    data:l_column type ref to cl_salv_wd_column,
          l_column1 type ref to cl_salv_wd_column,
          lr_input type ref to cl_salv_wd_uie_input_field,
          l_input1 type ref to cl_salv_wd_uie_input_field.
    l_column = l_value->if_salv_wd_column_settings~get_column( 'PRICE' ).
    create object lr_input
      exporting
        value_fieldname = 'PRICE'
    l_column->set_cell_editor( value = lr_input ).
    * to make some cells non editable
    lr_input->set_read_only_fieldname( value = 'READONLY' ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'READONLY'   )
    *Set the table Editable
    l_value->if_salv_wd_table_settings~set_read_only( value = abap_false ).
    *Give colors to cells
    l_column1 = l_value->if_salv_wd_column_settings~get_column( 'CARRID' ).
    l_column1->set_cell_design_fieldname( value = 'CELLDESIGN'  ).
    l_value->if_salv_wd_column_settings~delete_column( id = 'CELLDESIGN' )
    endmethod.
    Thanks
    Suman

  • How to set color to a column in ALV?

    Based on standard example BCALV_GRID_01 to modify,
    how to set color to a column???
    Moderator message: please search for available information/documentation before asking.
    Edited by: Thomas Zloch on Nov 6, 2010 9:43 AM

    Hi Sai ,
    you are posting the querry in the wrong forum ..
    but still I will answer ur querry...
    Incase you are not using the standard class to make your ALV then u can set the color of each column in the propertiesof column in the design time .
    Incase u see the colors in the design time but is not able to see the colors at the run time then you check the settings of the table I dont have system right now else I could have told you exact property...
    else if u r amking alv from the standard class then u will have to search the net for the method to color the same ..
    Thanks
    Sahil.

  • ALV color priority:  The layout color or the cell color?

    I'm trying to assign an ALV at the cell level but it is not showing up.  I have specificed the column color at the layout level.  Does the layout level have color priority?

    Hi
    see the doc and do accordingly
    1. add one more field to ur final internal table say COLOR(4)
    2. in layout wa_layout-style_fname = 'COLOR'. " if its grid
    wa_layout-style_fieldname = 'COLOR'. "if its list
    3. read table itab index 3.
    itab-color = 'C410'.
    modify itab index 3
    4. see program SHOWCOLO for all color codes
    1. Add a field of data type CHAR(3) to the internal output table.
    2. Enter the color code in the appropriate field of the row to be colored in the internal
    output table:
    Code: 'Cxy'
    C = Color (all codes begin with 'C')
    x = color number ('1' - '9')
    y = highlight ('0' = off, '1' = on)
    3. Assign the internal output table color code field name to the IS_LAYOUT importing
    structure IS_LAYOUT-INFO_FIELDNAME field and pass this structure in the ALV call
    interface.
    To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, let’s modify declaration of our list data table “gt_list”.
    you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field “INFO_FNAME” of the layout structure.
    e.g.
    ps_layout-info_fname = <field_name_containing_color_codes>. “e.g. ‘ROWCOLOR’
    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
    You can color an entire row as described in the next section. However, this method is less time consuming.
    Coloring Individual Cells
    This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by “more” is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.
    The structure that should be included must be of type “LVC_T_SCOL”. If you want to color the entire row, this inner table should contain only one row with field “fname” is set to space, some color value at field “col”, “0” or “1” at fields “int” (intensified) and “inv” (inverse).
    If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field “fname”. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table.
    Regards
    Anji

  • Problem with checkbox column in ALV popup (ABAP)

    Hi, the problem is: I've created the code below for maintaining a popup with an ALV table inside. One of the column is a checkbox field. When I run first time the popup, it run well, when I clode the popup window and then I run for second time the popup, i see all the columns except those with the checkbox. Someone else have encountered the same proble, if yes someone could me explain that? Here's the code:
    method WDDOINIT .
    data: l_ref_cmp_usage type ref to if_wd_component_usage.
      l_ref_cmp_usage =   wd_This->wd_CpUse_ALV( ).
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
      DATA: l_ref_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
      l_ref_INTERFACECONTROLLER =   wd_This->wd_CpIfc_ALV( ).
      data:
      l_VALUE type ref to Cl_Salv_Wd_Config_Table.
      data:  l_tabset  type ref to IF_Salv_Wd_Table_SETTINGS.
    l_VALUE = l_ref_INTERFACECONTROLLER->Get_Model( ).
      l_tabset ?= l_value.
      l_tabset->set_read_only( abap_false ).
      l_tabset->SET_VISIBLE_ROW_COUNT( 15 ).
      l_tabset->set_width( '500' ).
      l_tabset->SET_DESIGN( VALUE = CL_WD_TABLE=>E_DESIGN-ALTERNATING ).
    data:
        lr_std_functions type ref to if_salv_wd_std_functions,
        l_table          type ref to if_salv_wd_function_settings.
      lr_std_functions ?= l_value.
      lr_std_functions->SET_EXPORT_ALLOWED( Abap_false ).
      lr_std_functions->SET_VIEW_LIST_ALLOWED( Abap_false ).
      lr_std_functions->SET_PDF_ALLOWED( Abap_false ).
      lr_std_functions->SET_DIALOG_SETTINGS_ALLOWED(  Abap_off ).
      lr_std_functions->SET_DIALOG_SETTINGS_AS_POPUP( Abap_off ).
      lr_std_functions->SET_DISPLAY_SETTINGS_ALLOWED( abap_off ).
      lr_std_functions->SET_EDIT_APPEND_ROWS_ALLOWED( abap_off ).
      lr_std_functions->SET_EDIT_APPEND_ROW_ALLOWED( abap_off ).
      lr_std_functions->SET_EDIT_CHECK_AVAILABLE( abap_off ).
      lr_std_functions->SET_EDIT_DELETE_ROW_ALLOWED( abap_off ).
      lr_std_functions->SET_EDIT_INSERT_ROWS_ALLOWED( abap_off ).
      lr_std_functions->SET_EDIT_INSERT_ROW_ALLOWED( abap_off ).
      lr_std_functions->SET_PDF_ALLOWED( abap_off ).
      data: lr_column   type ref to cl_salv_wd_column.
    instancing check box
      data: lr_checkbox type ref to cl_salv_wd_uie_checkbox.
      create object lr_checkbox
              exporting
                checked_fieldname = 'CHECK'.
      lr_checkbox->set_read_only( value = abap_false ).
      lr_column = l_value->if_salv_wd_column_settings~get_column( 'CHECK' ).
      lr_column->set_cell_editor( lr_checkbox ).
    endmethod.
    Thanks for answers.

    This is just some guessing - but try and set a breakpoint in the wddoinit of your popup.  I'm betting that it isn't being executed on the second call because the original instance is reused. 
    Take a look at the properties on the view for the popup.  You might try  changing the lifetime of the view from "framework controlled" to "when visible".

  • Keep Auto Fill Down A Column With Blank Cells

    Hello,
    I understand if one blank cell is left, auto fill cannot continue through out the rest of the column.
    Is there a way to "trick" the cell into thinking there is information in the blank cell, in order for it to continue to auto-fill? 
    Please help

    You could enter a space in a cell - it will appear to be blank. An apostrophe will work too - this makes the cell contain an empty string value.
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Partial Blank cells in columns suing GUI_DOWNLOAD

    Hi,
    Could you please suggest for,after downloading data using GUI_DOWNLOAD ,I am getting blank cells in some part of columns and it's corresponding data is shifting to next columns .
    country COUNTRY CODE
    IN 123
    AU 123
    Empty Cell    IN 123
    Empty Cell    IN 123
    AU 123
    IN 123
    US 123
    IN 123
    US 123
    in country "COUNTRY" column 3rd and 4th records shifted to next and it became a blank cell.
    so,pls.. suggest me ,if any one could help for the same for which I am thankful to you.
    Maheswar.A.U.

    what type of file you are passing?

  • Alv cell color with FM

    hi ,
    can one send me program for alv cell color with help of function modules
    kiran

    Hi Kiran .
    <b>1.Cell Color.</b>
    While Building Fieldcatalog ,there is one field called
    EMPHASIZE.You have to set like this .
    i_field-emphasize = 'C26'.
    <b>2.ROW COLOR.</b>
    Have a look at this example .
    <b>a</b>.Define one variable COLOR in ur main ITAB.
    <b>b</b>.Fill it .
    <b>c</b>.Pass this info.
      w_layout-info_fieldname = 'COLOR'.
    <b>d</b>. display it .
    *& Report  ZGRID_COLOR                                                 *
    REPORT  zgrid_color                             .
    TYPE-POOLS slis.
    DATA: BEGIN OF i_pa0001 OCCURS 0,
    <b>        color(3) TYPE c,</b>
            pernr TYPE pa0001-pernr,
            subty TYPE pa0001-subty,
          END OF i_pa0001.
    DATA :i_field TYPE slis_t_fieldcat_alv,
          w_field LIKE LINE OF i_field,
          w_layout TYPE slis_layout_alv.
    START-OF-SELECTION .
      PERFORM get_data.
      PERFORM fieldcat.
      PERFORM layout_build.
      PERFORM dispaly .
    *&      Form  fieldcat
    FORM fieldcat .
      CLEAR :w_field,i_field[].
      w_field-fieldname = 'PERNR'.
      w_field-tabname   = 'I_PA0001'.
      w_field-seltext_m = 'PERNR'.
      APPEND w_field TO i_field.
      CLEAR w_field.
      w_field-fieldname = 'SUBTY'.
      w_field-tabname   = 'I_PA0001'.
      w_field-seltext_m = 'SUBTY'.
      APPEND w_field TO i_field.
      CLEAR w_field.
    ENDFORM.                    " fieldcat
    *&      Form  dispaly
    FORM dispaly .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = 'ZGRID_COLOR'
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
    <b>   is_layout                         = w_layout</b>
       it_fieldcat                       = i_field
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = i_pa0001
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " dispaly
    *&      Form  get_data
    FORM get_data .
      SELECT pernr subty
      FROM pa0001
      INTO CORRESPONDING FIELDS OF TABLE i_pa0001
      UP TO 10 ROWS.
    LOOP AT i_pa0001.
        IF sy-tabix GT 5.
      <b>    i_pa0001-color = 'C51'.</b>
          MODIFY i_pa0001 INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " get_data
    *&      Form  layout_build
    FORM layout_build .
    <b>  w_layout-info_fieldname = 'COLOR'.</b>
    ENDFORM.                    " layout_build
    I hope it helps u .
    <b>Thanks,
    Venkat.O</b>

  • Add Cells in an Excel Column Until the Next Blank Row

    Is there an easy way to sum the cells in an Excel column and to stop adding after the last populated cell in that series.
    I have tried several examples found on the www, but they have not worked.
    Doug in York PA
    Douglas R. Eckert

    Wind Zhang:  I have tried entering the formula above in cell A1, but it did not work.  It returned "0" instead if "21".  I tried entering the array formula with ALT+SHIFT+ENTER and with CTRL+SHIFT+ENTER,
    with the same result.
    Doug in York PA
    Douglas R. Eckert

  • Cell color

    Hello,
    I am using the ALV OO for the display.
    I need to color a particular cell.
    How can i do it ?
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        I_STRUCTURE_NAME              = 'gt_STRUCT'
        I_SAVE                        = X_SAVE
        I_DEFAULT                     = LV_DEF
       IS_LAYOUT                     = LS_LAYOUT
      CHANGING
        IT_OUTTAB                     = GT_BPSTAB[]
        IT_FIELDCATALOG               = GT_FIELDCATALOG[]
      EXCEPTIONS
        INVALID_PARAMETER_COMBINATION = 1
        PROGRAM_ERROR                 = 2
        TOO_MANY_LINES                = 3
        OTHERS                        = 4

    Hello,
    Check this example,it may help u.
    report z_example.
    tables : mara.
    Type
    types : begin of ty_mara,
              matnr         like mara-matnr,
              matkl         like mara-matkl,
              counter(4)    type n,
              free_text(15) type c,
              color_line(4) type c,           " Line color
              color_cell    type lvc_t_scol,  " Cell color
    end of ty_mara.
    Structures
    data  : wa_mara     type ty_mara,
            wa_fieldcat type lvc_s_fcat,
            is_layout   type lvc_s_layo,
            wa_color    type lvc_s_scol.
    Internal table
    data : it_mara     type standard table of ty_mara,
           it_fieldcat type standard table of lvc_s_fcat,
           it_color    type table          of lvc_s_scol.
    Variables
    data : okcode like sy-ucomm,
           w_alv_grid          type ref to cl_gui_alv_grid,
           w_docking_container type ref to cl_gui_docking_container.
    parameters : p_column as checkbox,
                 p_line   as checkbox,
                 p_cell   as checkbox.
    at selection-screen output.
      perform get_data.
      perform fill_catalog.
      if w_docking_container is initial.
        perform create_objects.
      endif.
    *&      Form  create_objects
    form create_objects.
      create object w_docking_container
        exporting
          ratio                       = 60
        exceptions
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          others                      = 6.
      create object w_alv_grid
        exporting
          i_parent          = w_docking_container.
    Field that identify color line in internal table
      move 'COLOR_LINE' to is_layout-info_fname.
    Field that identify cell color in inetrnal table
      move 'COLOR_CELL' to is_layout-ctab_fname.
      call method w_alv_grid->set_table_for_first_display
        exporting
          is_layout                     = is_layout
        changing
          it_outtab                     = it_mara
          it_fieldcatalog               = it_fieldcat
        exceptions
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          others                        = 4.
    endform.
    *&      Form  get_data
    form get_data.
      select * from mara up to 5 rows.
        clear : wa_mara-color_line, wa_mara-color_cell.
        move-corresponding mara to wa_mara.
        add 1                   to wa_mara-counter.
        move 'Blabla'           to wa_mara-free_text.
        if wa_mara-counter = '0002'
        and p_line = 'X'.
    Color line
          move 'C410' to wa_mara-color_line.
        elseif wa_mara-counter = '0004'
        and p_cell = 'X'.
    Color cell
          move 'FREE_TEXT' to wa_color-fname.
          move '6'         to wa_color-color-col.
          move '1'         to wa_color-color-int.
          move '1'         to wa_color-color-inv.
          append wa_color to it_color.
          wa_mara-color_cell[] = it_color[].
        endif.
        append wa_mara to it_mara.
      endselect.
    endform.
    *&      Form  fill_catalog
    form fill_catalog.
    Colour code :                                                 *
    Colour is a 4-char field where :                              *
                 - 1st char = C (color property)                  *
                 - 2nd char = color code (from 0 to 7)            *
                                     0 = background color         *
                                     1 = blue                     *
                                     2 = gray                     *
                                     3 = yellow                   *
                                     4 = blue/gray                *
                                     5 = green                    *
                                     6 = red                      *
                                     7 = orange                   *
                 - 3rd char = intensified (0=off, 1=on)           *
                 - 4th char = inverse display (0=off, 1=on)       *
    Colour overwriting priority :                                 *
      1. Line                                                     *
      2. Cell                                                     *
      3. Column                                                   *
      data : w_position type i value '1'.
      clear wa_fieldcat.
      move w_position to wa_fieldcat-col_pos.
      move 'MATNR'    to wa_fieldcat-fieldname.
      move 'MARA'     to wa_fieldcat-ref_table.
      move 'MATNR'    to wa_fieldcat-ref_field.
      append wa_fieldcat to it_fieldcat.
      add 1 to w_position.
      clear wa_fieldcat.
      move w_position to wa_fieldcat-col_pos.
      move 'MATKL'    to wa_fieldcat-fieldname.
      move 'MARA'     to wa_fieldcat-ref_table.
      move 'MATKL'    to wa_fieldcat-ref_field.
    Color column
      if p_column = 'X'.
        move 'C610'     to wa_fieldcat-emphasize.
      endif.
      append wa_fieldcat to it_fieldcat.
      add 1 to w_position.
      clear wa_fieldcat.
      move w_position to wa_fieldcat-col_pos.
      move 'COUNTER'  to wa_fieldcat-fieldname.
      move 'N'        to wa_fieldcat-inttype.
      move '4'        to wa_fieldcat-intlen.
      move 'Counter'  to wa_fieldcat-coltext.
      append wa_fieldcat to it_fieldcat.
      add 1 to w_position.
      clear wa_fieldcat.
      move w_position  to wa_fieldcat-col_pos.
      move 'FREE_TEXT' to wa_fieldcat-fieldname.
      move 'C'         to wa_fieldcat-inttype.
      move '20'        to wa_fieldcat-intlen.
      move 'Text'      to wa_fieldcat-coltext.
      append wa_fieldcat to it_fieldcat.
    endform.
    Regards

Maybe you are looking for

  • How to delete a corrupted file

    I have a file that failed in the process of being copied from a local hard drive to an external drive connected to my Time Capsule. The Finder sometimes reports the partially copied file as there and sometimes not. I have tried to delete the corrupte

  • ISE 1.2 My device portal is not work

    I cannot login to my device portal with username and password in AD. It shows the massage "Username and Password is invalid" But i can login by internal user in ISE. I check the sequence in Authentication. AD is the first. PS. I use the username in A

  • Adobe Photoshop CS6 serial number

    I recently bought adobe photoshop CS6.  I retrieved the serial number from my products and services and attempted to install.  Its telling me that its not a valid serial number

  • Playback movie burned to DVD from iPhoto

    When I burn a movie to a DVD from iPhoto I get an error message on playback that says "the movie contains an invalid data reference and will not playback". Any suggestions?

  • Oraclepreparestatement and WebSphere data source

    Currently, I'm using data source in WebSphere instead of DriverManager.getConnection() to getting the database connection. Although I'm able to get the connection, but I failed to call OraclePrepareStatetement and OraclePrepareStatetement.setFormOfUs