Highlight ALV cells conditionally?

Good afternoon
Iu2019ve been introduced to the following way of ALV generation by some colleagues, but would like to know if there is a way to highlight certain cells conditionally?
The highlighting could be anything from a different font to a different background color for instance. Thanks.
*&      Form  output_alv
form output_alv.
  data gr_table     type ref to cl_salv_table.
  data gr_display   type ref to cl_salv_display_settings.
  data gr_functions type ref to cl_salv_functions.
  data gr_sorts     type ref to cl_salv_sorts.
  try.
      cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = gt_data ).
    Set zebra layout
      gr_display = gr_table->get_display_settings( ).
      gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
    Display all standard function
      gr_functions = gr_table->get_functions( ).
      gr_functions->set_all( abap_true ).
      gr_table->display( ).
    catch cx_salv_msg.
      write: / 'Exception CX_SALV_MSG'.
    catch cx_salv_not_found.
      write: / 'Exception CX_SALV_NOT_FOUND'.
    catch cx_salv_data_error.
      write: / 'Exception CX_SALV_DATA_ERROR'.
    catch cx_salv_existing.
      write: / 'Exception CX_SALV_EXISTING'.
  endtry.
endform.                    " output_alv

>
Adrian Bruwer wrote:
> If I could find a relevant post regarding the specific class and factory I would not post a question... have a nice day
Well, although you will probably never find a specific answer to your specific problem by searching, you should be able to find enough to work it out on your own.
So as indicated by the answer you marked as solving your question, the answer really was RTFM.
Rob

Similar Messages

  • How Highlight a CELL on an ALV table

    Hi all!
    I'm trying to do some checks on an input field of an ALV table component. But using REPORT_ATTRIBUTE_T100_MESSAGE it doesn't highlight the CELL of the row if the check hasn't been passed succesfully.
    I've used this source code but nothing appears on the screen, no message and no cell highlighted. I put my source code for more information:
    LOOP AT lt_data_mod INTO ls_data_mod.
    alternative access via index
    lo_el_n_empleado = lo_nd_n_empleado->get_element( index = ls_data_mod-index ).
    CHECK VALUE
    report message
    CALL METHOD wd_comp_controller->go_message->report_attribute_t100_message
    EXPORTING
    msg = ls_msg
    element = lo_el_n_empleado
    attribute_name = ls_data_mod-attribute. " The name of input field that it is being modified
    All that source code is in ON_DATA_CHECK event of ALV component.
    Can anyone help me ?
    Thanks!

    Hello,
    I put my source code:
    ON_DATA_CHECK event of ALV:
      lt_data_mod[] = lr_data->t_modified_cells[].
      LOOP AT lt_data_mod INTO ls_data_mod.
    alternative access  via index
    lo_el_n_empleado = lo_nd_n_empleado->get_element( index = ls_data_mod-index ).
    get all declared attributes
        lo_el_n_empleado->get_static_attributes(
          IMPORTING
            static_attributes = ls_n_empleado ).
    Leemos la información inicial para hacer posteriormente los recalculos.
        READ TABLE wd_this->gt_empleados_inicial INTO ls_empleados_inicial WITH KEY pernr = ls_n_empleado-pernr.
        ASSIGN ls_data_mod-r_value->* TO .
    Fijamos el valor del campo INCIN o PERIN en función de si el usuario ha modificado el valor en pantalla
        IF ls_data_mod-r_value NE ls_data_mod-r_old_value AND
            GE ls_n_empleado-incsu.
          IF ls_data_mod-attribute = 'INCPA'.
            ls_n_empleado-incin = abap_true.
          ELSEIF ls_data_mod-attribute = 'PERVC'.
            ls_n_empleado-perin = abap_true.
          ENDIF.
    ELSEIF <fs_data> LT ls_n_empleado-incsu. " Check if user entry is less than incsu value then throw message...
          wd_comp_controller->show_message_2( imp_element = lo_el_n_empleado
                                                                               imp_msgno   = '622'
                                                                               imp_attr    = ls_data_mod-attribute ). " El valor introducido es menor que el "                 incremento sugerido
        ENDIF.
    METHOD show_message_2 .
      DATA lv_message_id TYPE string.
      DATA ls_msg TYPE symsg.
      ls_msg-msgty = 'E'.
      ls_msg-msgid = 'ZHR_CM'.
      ls_msg-msgno = imp_msgno.
    report message
      CALL METHOD wd_this->go_message->report_attribute_t100_message
        EXPORTING
          msg            = ls_msg
          element        = imp_element
          attribute_name = imp_attr.
    ENDMETHOD.
    Also I've tried with report_element_t100_message method but nothing happens.
    Thank you.
    Edited by: vanbelal on Mar 22, 2010 4:54 PM

  • Conditional Highlighting multiple cells

    I've created a schedule for specific actions performed. There are over 200 actions and when I use one, it needs to be "unavailable" for the following 3 entries. If I can, I want to check the box on that cell and have it auto highlight that cell and the following three cells after so I can black it out until it's "available" again. Is there a way to do this?
    EDIT: Also, if there is a way to auto check those 3 subsequent cells, I'm good with that too.

    Like quinn's use of OR!
    AppleScript is good at conditional highlighting of ranges.  For example I get this when running the script below. (The actual table is formatted as checkboxes but shows here as TRUE and FALSE).
    Week
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    Song 1
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    Song 2
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    Song 3
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    FALSE
    Song 3
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    Copy the script, paste into AppleScript Editor, click once in the table (this is important or the script won't know which table you mean), and click the green triangle run button. 
    This works with Numbers 3.  Numbers 2 would require changes in the script. Change orange to whatever you want.
    SG
    The script:
    property firstCheckCol : 2
    property firstDataRow : 2
    tell application "Numbers"
      set t to front document's active sheet's first table whose selection range's class is range
      set vv to t's rows's cells's value -- place values in "list of lists"
      set numCols to count vv's item 1
      repeat with r from firstDataRow to count vv
      repeat with c from 3 to numCols
      tell vv's item r
      try
      if its item (my max(c - 1, firstCheckCol)) ¬
      or its item (my max(c - 2, firstCheckCol)) ¬
      or its item (my max(c - 3, firstCheckCol)) ¬
      is true then
      set t's row r's cell c's background color to "orange"
      end if
      end try
      end tell
      end repeat
      end repeat
    end tell
    on max(x, y)
      if x > y then return x
      return y
    end max

  • Alv cell display

    hi all,
    In alv ,how can we ,de highlight the cell border when no data is available for the output field.
    Anitha

    Hi,
    To my knowledge, we cannot highlight the border of the cell, Instaed u can fill the Cell with some color where there is no data.
    Is that your requirement.?
    Revart back,
    regards
    Naveen

  • Set ALV Cell visibility property

    Hi,
    I would have 2 tables for ALV. One table consists of the data to be bound to the ALV. The other table would have the read only property(boolean) filled for each of the ALV cells.
    I would want to set the property of each ALV cell using the second table. How do i do that?
    Currently i am just testing it for few attributes statically using the below code.
    DATA lo_nd_date_table TYPE REF TO if_wd_context_node.
    DATA lo_el_date_table TYPE REF TO if_wd_context_element.
    DATA: lt_ele_set TYPE wdr_context_element_set.
    navigate from <CONTEXT> to <DATE_TABLE> via lead selection
      lo_nd_date_table = wd_context->get_child_node( name = wd_this->wdctx_date_table ).
    lt_ele_set = lo_nd_date_table->get_elements( ).
      LOOP AT lt_ele_set INTO lo_el_date_table.
          lo_el_date_table->set_attribute_property(
               attribute_name = 'WK02'                                 -
    > Attribute Name (Column Name)
               property       = if_wd_context_element=>e_property-read_only
               value          =  'X' ).
    << Similarly for other attributes>>
    ENDLOOP.
    I have inserted this code at the end. Initially few other properties were set to the cells.
    This seems to be not working.
    Regards,
    Rekha
    Edited by: Rekha Gopinath on Sep 8, 2009 10:40 AM

    Hi Lekha,
    In my case, the columns represents dates. The rows represent projects. So, only those row cells are editable where the project is valid.
    1. I have created READ_ONLY attribute for the date node (table).
    2. I am filling the READ_ONLY to abap_true or abap_false based on the following condition.
       Even if one of the projects is not valid for a date, then READ_ONLY = ABAP_TRUE. This means, even if one cell is set to abap_true, then READ_ONLY is set to abap_true.
    3. I modify the date node and bind it with the READ_ONLY set row wise.
    Loop at the data and set read only
      navigate from <CONTEXT> to <DATE_TABLE> via lead selection
      lo_nd_date_table = wd_context->get_child_node( name = wd_this->wdctx_date_table ).
      CALL METHOD lo_nd_date_table->get_static_attributes_table
        IMPORTING
          table  = lt_date_table    .
      LOOP AT lt_date_table INTO ls_date_table.
        lv_tabix = sy-tabix.
          READ TABLE wd_this->gt_prop INTO ls_prop INDEX lv_tabix.
          IF sy-subrc EQ 0.
            IF ls_prop-wk01 = abap_true OR         
              ls_prop-wk02 = abap_true OR
              ls_prop-wk03 = abap_true OR
              ls_prop-wk04 = abap_true OR
              ls_prop-wk05 = abap_true OR
              ls_prop-wk06 = abap_true OR
              ls_prop-wk07 = abap_true OR
              ls_prop-wk08 = abap_true OR
              ls_prop-wk09 = abap_true OR
              ls_prop-wk10 = abap_true OR
              ls_prop-wk11 = abap_true OR
              ls_prop-wk12 = abap_true OR
              ls_prop-wk13 = abap_true OR
              ls_prop-wk14 = abap_true OR
              ls_prop-wk15 = abap_true.
              ls_date_table-read_only = abap_true.
            ELSE.
              ls_date_table-read_only = abap_false.
            ENDIF.
          ENDIF.
        MODIFY lt_date_table FROM ls_date_table INDEX lv_tabix TRANSPORTING read_only.
      ENDLOOP.
      CALL METHOD lo_nd_date_table->bind_table
        EXPORTING
          new_items            = lt_date_table
          set_initial_elements = abap_true.
    4. I loop through the column reference and use the code mentioned earlier.
              CREATE OBJECT lr_input
                EXPORTING
                  value_fieldname = lv_id.
              lo_column->set_cell_editor( value  = lr_input ).
              lr_input->set_read_only_fieldname( value = 'READ_ONLY' ).
    The expected output is different from the input i had mentioned earlier for Row 1, row 2, Row 3 and row 4. Here, i would get all the rows as non editable except for Row 3.
    I would want to set all columns based on condition.
    Regards,
    Rekha

  • How do I highlight multiple cells in a form?

    I created a form in Acrobat X.  Previously, when the customer filled the (Excel) form and returned it, our staff would be able to highlight an entire column and paste it into another software package that tracks expenses etc.  Now, with a requirement of digital signatures on our forms (as well as a few other requirements that the PDF form fulfills), we need to go the PDF route instead fo Excel.  The downside to the PDF is that I can't figure out how to make it so that our staff can highlight an entire column and copy paste. 
    For example, if it were the table below.  Pressing "select all" in Reader would only highlight the cells A1 - D1 and A1 - A7, the cells that say "TXT ENTERED TO FORM" would not be highlighted.  I would not be able to highlight the cells (like you can in Excel) B2 - D2.
    A1
    B1
    C1
    D1
    A2
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    A3
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    A4
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    A5
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    A6
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    A7
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    TXT ENTERED TO FORM
    Any assistance or suggestions would be greatly appreciated!

    You state that you have "Multiple lines" checked but you don't get multiple lines. Does this mean you don't see visually mulitple lines or you have tested the form and you can't enter in multiple lines? If you are wanting the field to expand as you type, please check out my solution here: http://forums.adobe.com/thread/832659?tstart=0.
    Mallard27

  • Can you select the row in a table view without highlighting the cell?

    I have an an app with a table view which is presented modally. Cell selections in this table are saved in the parent controller so that they can be reselected if the table is reloaded after being dismissed.
    When the cell is first highlighted, I want to momentarily highlight the cell and have it fade out, which I do by unselecting the cell from the modal view controller's didSelectRowAtIndexPath by calling setSelected:animated on the table view cell.
    However, when I present the table view controller modally again and want to display the previously selected cell as selected, I don't want the cell background to be highlighted, and I'm having trouble doing this.
    In order to make sure the table view knows the cell is selected, I am calling selectRowAtIndexPath. I need to make sure the cell is selected so that I can set/unset the cell's accessoryType. However, this has the sideeffect of highlighting the cell too, which looks weird and confusing to the user.
    I've tried things like temporarily setting the cell's selection style to none, but while that stops the cell background from highlighting? I've tried setting the selectionStyle to UITableViewSelectionStyleNone, but while this prevents the cell background from highlighting, the cell text still changes to white, so it the text is invisible against the white background.
    Is there a easy way of setting a cell to selected in the table view without also changing the highlight and text colour of the actual cell? Immediately setting the cell to be unselected still makes the highlight visible for a split second.

    I tried that, but setting the highlighted property doesn't seem to affect it.
    I figured out how what I was doing wrong though. I was setting selection style UITableViewSelectionStyleNone, selecting the cell, then setting the selection style back to whatever it had previously been. This causes the background not to draw highlighted, but the text and accessory type to still draw highlighted.
    In order to fix this, I moved the code to set the cell selection style to whatever it had previously been to the didDeselectRowAtIndexPath method.

  • Highlight text using conditional text

    Hi,
         I need to highlight text using conditional text in InDesign.  I can highlight text using the below code.
    var myDoc = app.activeDocument;
    colorToHighlig = myDoc.conditions.add ({name:"Yellow",indicatorMethod:ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor:UIColors.YELLOW});
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.changeGrepPreferences.appliedConditions = [colorToHighlig] ;
    app.findGrepPreferences.findWhat = "chapter";
    myDoc.changeGrep();
    But I need to set Indicator to "Show and Print" coz while generation pdf with indicator mode "show", highlights are missing in PDF.  I can retain those highlights with the indicator mode "Show and Print". Dono how to set it..
    If anyone know, pls help me.
    Thanks in advance,
    Sudha K

    Hi,
    it seems, that this one is not a property of the condition, it is a preference:
    myDoc.conditionalTextPreferences.showConditionIndicators = ConditionIndicatorMode.SHOW_AND_PRINT_INDICATORS;

  • How do you highlight several cells with the mouse in numbers

    how do you highlight several cells with the mouse in numbers

    Hi David,
    Using only the mouse, you can select a contiguous range of cells using the method described by dwb.
    For larger (but still contiguous) ranges you might prefer this method:
    Click the first (top left) cell of the desired selection.
    Scroll to the last (botom right) cell of the desired selection.
    Shift-click the bottom right cell to select it, and all of the cells in the rectangular array defined by this and the top left cell selected in step 1.
    To select two or more non-contiguous cells:
    Click on the first to select it.
    Command-click on another to add it to the selection.
    Repeat as necessary.
    Regards,
    Barry

  • Highlight Changed Cells - Too many cells (no named range)?

    Hello,
    I implemented the Highlight Changed Cells Function as described in the How-To-Paper from Gerd Schoeffl (How To...Highlight Changed Cells in SAP BusinessObjects Analysis for Office).
    In my workbook I have two tabs with different crosstabs. I noticed that the highlighting function only works for one of them and that there is a warning for the other one: "There is no named range for Crosstab1". In the coding I saw that the error message is put out by the Highlighting Changed Cells subs but I am not sure why the problem occurs (I could not find out at which point of the runtime the error occurs, even when I tried debugging it).
    When I restrict the selection to less cells it works for the same crosstab. Therefore I would assume that there are simply too many cells for the function to work, is that possible? And if so, has anybody found a solution? In the crosstab there are 376 rows and 21 columns...
    This is the code that contains the error message:
    Sub createMapInitial(CrossTabName As String)
        Dim map As Object
        Dim cross As Range
        Dim Cell As Variant
        Set map = CreateObject("Scripting.Dictionary")
        On Error GoTo RangeNotFound
        Set cross = Range("SAP" + CrossTabName)
        Dim RowSel As Object
        Dim ColSel As Object
        Dim rowkey As Variant
        Dim colkey As Variant
        Dim keyMap As String
    ' delete the last selection tables
        If Not RowSel Is Nothing Then
            Set RowSel = Nothing
        End If
        If Not ColSel Is Nothing Then
            Set ColSel = Nothing
        End If
        Set RowSel = CreateObject("Scripting.Dictionary")
        Set ColSel = CreateObject("Scripting.Dictionary")
        Call FillSelTabs(CrossTabName, RowSel, ColSel)
        For Each Cell In cross
            If isDataCell(Cell) = True Then
                rowkey = RowSel.Item(Cell.row)
                colkey = ColSel.Item(Cell.column)
                keyMap = rowkey + colkey
                Call map.Add(keyMap, Cell.value)
            End If
        Next
        Call MapCollection.Add(CrossTabName, map)
        On Error GoTo 0
        Exit Sub
    RangeNotFound:
        Dim text As String
        text = "There is no named range for " + CrossTabName
        Call Application.Run("SAPAddMessage", text)
        On Error GoTo 0
    End Sub
    Thanks, Jan

    Hi Werner,
    I disabled the OnError handling which gave me some progress:
    Now when I switch on the Highlight Changes function I receive this error message:
    When I click Debug it takes me to the following part of the "update MAP and compare" sub (code will be posted below):
    From my understanding in this step a key is created that consists of an identifiert (the first big string) and the elements of the selection of the data source (e.g. 27 is the region, 1144 the plant number). The smallest unit in our case is the plan and we don't have the same plant number twice in our selection, therefore the key should be unique.
    When I remove the plant from my selection by filtering suddenly the Highlight Changes function works again. So it seems that this plant causes the problem but I don't really understand why. Does anybod have an idea?
    Here the missing code of update map and compare (same as in the How To Paper):
    Public Sub updateMapAndCompare(CrossTabName As String)  ' when called the first time, the before status must be kept - and no delta is possible
        If MapCollection Is Nothing Then
            Set MapCollection = CreateObject("Scripting.Dictionary")
        End If
    ' do we have information about the current crosstab already?
        Dim isNewMap As Boolean
        isNewMap = Not MapCollection.exists(CrossTabName)
        If isNewMap = True Then
            Call createMapInitial(CrossTabName)
            Exit Sub
        End If
        Dim isNewDataCell As Boolean
        Dim isChangedDataCell As Boolean
        Dim keyMap As String
        Dim sel As Variant
        Dim map As Object
        Dim newMap As Object
        Set newMap = CreateObject("Scripting.Dictionary")
        Dim Cell As Variant
        Dim cross As Range
        'On Error GoTo RangeNotFound
        Set cross = Range("SAP" + CrossTabName)
    ' get the correct comparison table
        Set map = MapCollection.Item(CrossTabName)
        Dim RowSel As Object
        Dim ColSel As Object
        Dim rowkey As Variant
        Dim colkey As Variant
    ' delete the last selection tables
        If Not RowSel Is Nothing Then
            Set RowSel = Nothing
        End If
        If Not ColSel Is Nothing Then
            Set ColSel = Nothing
        End If
        Set RowSel = CreateObject("Scripting.Dictionary")
        Set ColSel = CreateObject("Scripting.Dictionary")
        Call FillSelTabs(CrossTabName, RowSel, ColSel)
        For Each Cell In cross
            If isDataCell(Cell) = True Then
            ' task1: build up new before status - as reference for next comparison
                rowkey = RowSel.Item(Cell.row)
                colkey = ColSel.Item(Cell.column)
                keyMap = rowkey + colkey
                Call newMap.Add(keyMap, Cell.value)
            ' task2: check if cell values has changed or newly occured
                isNewDataCell = Not map.exists(keyMap)
                If isNewDataCell = True Then
                    'Cell.Style = C_STYLE_NEW
                Else
                    isChangedDataCell = (map.Item(keyMap) <> Cell.value)
                        If isChangedDataCell = True Then Cell.Style = C_STYLE_CHANGED
                        End If
                End If
        Next
    ' update the MapCollection
        Set MapCollection(CrossTabName) = newMap
        'On Error GoTo 0
            Exit Sub
    RangeNotFound:
        Dim text As String
        text = "There is no named range for " + CrossTabName
        Call Application.Run("SAPAddMessage", text)
        'On Error GoTo 0
    End Sub

  • Why the apple told about this system for the new iphone 6 but the mine no see the change...?1:28 p.m. Wi-Fi calling is a new feature for making high-quality calls when cell conditions are poor.

    Hi apple. in the Keynotes about the new iphone you say..
    1:28 p.m.
    Wi-Fi calling is a new feature for making high-quality calls when cell conditions are poor.
    The question is Work That? i no see the change for me POOR signal here on my office..
    my carrier att. have very Poor Signal here on Aguadilla PR.. i take this PHone for this keynotes about the wifi calling is a new feature...
    please i need a new respont.. and check the security about iphone Someone call reply the text messenger from the Block area.

    It sounds as if you only had one line with an upgrade available. So you can only upgrade one line. For you to upgrade as well, you will have to wait until your upgrade is available. You can check that at MyVerizon. That's just how it works. All carriers and phone brands are the same. I have to wait until February to upgrade. The only thing you can do to get the new iPhone, is add a new line. But then you're paying for a line you don't need.

  • ALV cells as buttons

    Hello,
    I'm using attribute cl_gui_alv_grid=>mc_style_button to put some cells in my ALV as buttons. I need that when the user push those buttons an event is raised. Does someone have any example of buttons in ALV cells?
    Thank you and regards.

    Hello,
    I'm using attribute cl_gui_alv_grid=>mc_style_button to put some cells in my ALV as buttons. I need that when the user push those buttons an event is raised. Does someone have any example of buttons in ALV cells?
    Thank you and regards.

  • 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>

  • Report Query - Highlighting the cells that have a new value...

    hello all,
    I have to display a report in alv in web dynpro abap.
    In that I have to display two fields and both the fields are locations of different months.
    If the location is different than the previous one then i have to display cell with the new location in red color or highlighted.
    How can I achieve this.???
    Only for the changed ones it has to be highlighted or different color.....  I repeat.
    Happy Coding.

    IF want to display 2 locations , one  corresponding to location of previous month  and other corresponding to location of curr month  ,and if 2 are not same then current month location should be highlighted or displaying in red color . If this is what u want to do then try following .
    1]    In context where  ur data to be display exist  - In LIST NODE along with attribute  Location_previous_month , Location_current_month add attribute "COLOR" TYPE WDUI_TEXTVIEW_SEM_COL .
    2]   Find out the column which has to be marked with a different colour based on its content ( Location_ Current_ Month in your case )  . Assign the context attribute "COLOUR"  to the "Cell Design Fieldname" attribute of the respective column. This can be done while setting Column attributes for each of the ALV Columns
    IF find any problem in implementing above step then go thro' this link :
    http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP%20Web%20Dynpro%20ALV%20-%20Change%20Cell%20Colour%20based%20on%20Content
    3] In the method to fill the data to  be displayed .
      CREATE INTERNAL TABLE OF TYPE List node
    FILLINTERNAL TABLE CREATED ABOVE  ( SAY ITAB  ) WITH VALUES FOR  LOCATION_ CURRENT_ MONTH  , LOCATION_PREVIOUS_MONTH .
    FILL COLOR VALUE FOR EACH ROW OF ITAB AS FOLLOW 
    LOOP AT  ITAB INTO LS_ITAB .
       IF LS_ITAB-LOCATION_CURRENT_MONTH  <> LS-ITAB- LOACTION_PREVIOUS_MONTH .
                     COLOR = 06 ." 06 IS COLOR CODE 
       ENDIF .
    4] BIND THIS INTERNAL TABLE WITH NODE LIST_NODE .
      DATA NODE_LS_NODE TYPE REF TO IF_WD_CONTEXT_NODE .
    NODE_LS_NODE = WD_CONTEXT->GET_CHILD_NODE( NAME = 'LIST_NODE' ) .
             NODE_LS_NODE->BIND_TABLE ( EXPORTING
                       NEW_TAB = ITAB ).
    Hope thid will help .
    THKS ,
    RUSHIKESH
    Edited by: RUSHI123 on Oct 31, 2009 8:59 PM

  • ALV cell without displaying Zero.

    Hi ABAP gurus,
       I am working on alv report  and  i came across situation where we don't want to display zeros in
      some of the Cell based on some condition.
      i don't want to do it on column level otherwise i can use no_zero. i like to do it on cell base.
    Any help would be  appericated ..
    Thanks,
    Jack
    Edited by: jack troy on Jun 17, 2009 9:48 PM

    u can do that while passing values to ur final table..
    declare the field as string.
    pass value to it only when u need (as per ur conditions). else leave it blank.. that can avoid ur zeros..
    do u need a ref code??
    Edited by: soumya prakash mishra on Jun 17, 2009 9:50 PM

Maybe you are looking for