How to change the color of specific row in ALV tree

Hi,
I m using method set_table_for_first_display of a class CL_GUI_ALV_TREE.
The req is to change the color of specific row. Now can anybody tell me how to change the color of ALV tree. As in ALV tree and in this method 'set_table_for_first_display', there is no parameter IS_Layout.
Pls suggest...

hi
hope this code will help you.
Reward if help.
REPORT zsharad_test1.
TABLES: ekko.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
line_color(4) TYPE c, "Used to store row color attributes
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
Set layout field for row attributes(i.e. color)
gd_layout-info_fieldname = 'LINE_COLOR'.
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
IT_EVENTS = GT_XEVENTS
i_save = 'X'
is_variant = z_template
TABLES
t_outtab = it_ekko
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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
DATA: ld_color(1) TYPE c.
SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekko.
*Populate field with color attributes
LOOP AT it_ekko INTO wa_ekko.
Populate color variable with colour properties
Char 1 = C (This is a color property)
Char 2 = 3 (Color codes: 1 - 7)
Char 3 = Intensified on/off ( 1 or 0 )
Char 4 = Inverse display on/off ( 1 or 0 )
i.e. wa_ekko-line_color = 'C410'
ld_color = ld_color + 1.
Only 7 colours so need to reset color value
IF ld_color = 8.
ld_color = 1.
ENDIF.
CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
wa_ekko-line_color = 'C410'.
MODIFY it_ekko FROM wa_ekko.
ENDLOOP.
ENDFORM. " DATA_RETRIEVAL

Similar Messages

  • How to change a color for a row in ALV grid display

    Hi,
       how to change a color for a row in ALV grid display based on a condition.Any sample code plz

    Hello Ramya,
    Did you check in [SCN|How to color a row of  alv grid]
    Thanks!

  • BI BEANS - Graph - How to change the color .. please help

    Hi Everyone,
    Can anyone please tell me how to change the color of the Graph bars or slices. I mean the color which represents the data.
    For example in a pie chart I want to set specific color for specific slice. Please help.
    Regards
    SRT

    It seems to be the SET_SERIE_COLOR() method added to the FormsGraph revised version, but this latest version is momentarily not available for download.
    I think there is an existant open thread on this. Maybe you could find it using the Forum Search box.
    Francois

  • How to change the color of Menu links in obiee

    Does anyone knows how to change the colors of Menu links in obiee. With menu I mean the menu links default right top (Search, homepage, Catalogus, Dashboards, new, Open). This should be set in skin and style files, not? I searched a lot. I could not find It. It is now Oracle blue, we want to change this.
    obiee 11.1.1.5.
    Thanks

    You have to customize portal banner and portal content CSS files as needed in OBIEE server.
    below links will guide u but will will not tell you exactly but your req can be done by customizing portal content and portal banner CSS files. try to identify the exact code using firebug in mozilla.
    http://www.rittmanmead.com/2009/04/customizing-obiee-dashboard-banners/
    Customization of login page, banner,logo in obiee11g
    Thanks
    Jay.

  • How to change the color of SAP screen?

    Hi Frens,
    I know it has nothing to do with SD Community, but still I am asking. Can anyone tell me "How to change the color of SAP screen?" It is needed especially when you are working on System Landscape including PRD, Qua & Dev. There are chances that you end up making a test case in PRD instead of Dev or Qua. To avoid that, different color of SAP screen may be very useful and safe.
    Regards
    Vikas Chhabra
    SD/CIN Consultant

    We had a clone of SAP for testing
    Only GUIXT solution was available for users to distinguish between real Prod & Clone as SID was same
    Created 2 scripts n C:\guixt\scripts
    saplsmtr_navigation.e0100.txt
    Esession.txt
    BOTH having identical code
    if V[_ashost=10.3.3.18]
      TitlePrefix "CLONE18"
      TitleSuffix "(CLONE8)"
    endif
    if V[_ashost=10.3.3.25]
      TitlePrefix "PROD25"
      TitleSuffix "(PROD25)"
    endif
    After much research - this was only solution.
    GUIXT will be around; like SAPSCRIPT & SMARTFORMS
    despite the enticement of Adobe Forms!
    After some time you may set GUIXT profile start window HIDDEN
    This you do by clicking profile button of GUIXT menu
    If you want to see GUIXT Window again
    CMD.exe Dos prompt
    cd C:\Program Files\SAP\FrontEnd\SAPgui
    guixt visible
    Regards
    Jayanta Narayan Choudhuri
    Kolkata
    URL: http://ojnc.byethost11.com

  • How to change the color background in Pages for iPad?

    how to change the color background in Pages for iPad?

    You can find many themes at https://github.com/hdoria/xcode-themes  There's a download zip button on the right side of the page.
    Unzip and and copy the .dvtcolortheme files into /Users/YourUsername/Library/Developer/XCode/UserData/FontAndColorThemes Create the directory if it doesn't exist.
    If you can't find the Library directory you can get to it by using Finder's "Go to Folder..." option under "Go" or press shift + cmd + G then type the path.

  • How to change the color of SOLIDS ?

    Hi there,
    In the Effects panel, I select the color solids, we only have green and a few colors. I chose the green one as the background.
    Then I wanna choose my own color by changing the color of the green but my eyes are blind, I cannot find where the selection are ?
    Can anyone be kind enuf to let me know where the switch is ? How to change the color of the solids to be used as background ?
    Thanks
    Chers

    Luis Sequeira1 wrote:
    Drag your generator to the timeline. Select int. Look at the Inspector, in the top right corner (if the inspector is not open, you can use Cmd-4 to open it). At the top of the inspector, you have three buttons: "Generator", "Video", and "Info". Click on "Generator" and you get a drop down menu allowing you to choose one of six colors.
    If none of these six serves you well, you can then click on "Video", and use the Color tools to set it to anything you want.
    Thanks Luis for your detailed explanation ... it worked !

  • How to change the color for HTML words in JEditorPane?

    Hi Sir,
    In the JTextPane , we could change the word's color by using:
    Style style = doc.addStyle("test",null);
    StyleConstants.setForeground(style, Color.red);
    doc.setCharacterAttributes(10,20,syle,true);
    we can change the text into red color,which range is from 10 to 30.
    But how to change the color for HTML words in JEditorPane?

    Hi,
    you can use an AttributeSet to apply the foreground color. Let's say, doc is a HTMLDocument, then SimpleAttributeSet set = new SimpleAttributeSet();
    doc.getStyleSheet().addCSSAttribute(set, CSS.Attribute.COLOR, "#0D0D0D"); would apply a color to a given AttributeSet. The AttributeSet with your color then can be applied to a selected range of text in a JEditorPane by   /**
       * set the attributes for a given editor. If a range of
       * text is selected, the attributes are applied to the selection.
       * If nothing is selected, the input attributes of the given
       * editor are set thus applying the given attributes to future
       * inputs.
       * @param editor  the editor pane to apply the attributes to
       * @param a  the set of attributes to apply
      public void applyAttributes(JEditorPane editor, AttributeSet a) {
        ((HTMLDocument) editor.getDocument()).getStyleSheet().addCSSAttribute(set, CSS.Attribute.COLOR, "#0D0D0D");
        editor.requestFocus();
        int start = editor.getSelectionStart();
        int end = editor.getSelectionEnd();
        if(end != start) {
          doc.setCharacterAttributes(start, end - start, a, false);
        else {
          MutableAttributeSet inputAttributes =
            ((SHTMLEditorKit) editor.getEditorKit()).getInputAttributes();
          inputAttributes.addAttributes(a);
      } Ulrich

  • How to change the color of the text field of form

    Hi ,
    Is there any way to change the color of the text field of the form........
    Thnx in advance .......
    Cheers,
    Eman

    Hi Bob. I'm new to these forums and I'm not sure of protocol and exactly how this is supposed to work, so If I'm doing this wrong then please excuse me and let me know.
    I liked you solution on 'How to change the color of an Item on a form' using <blink>.
    I'm new to this application and coding as well so its kind of foreign to me.
    Working on a Report Page,
    I would like to have item, :P1_JOB_NO blink when the difference between sysdate and :P1_DATE_DUE < 7 days.
    I can identify the job_no which should blink by using the sql statement:
    SQL> select job_no from oax_projects07 where
    2 (sysdate - date_due < 7) and
    3 emp_name = 'GARY PILKENTON';
    JOB_NO
    20060627 050
    But I dont know the proper syntax to make it blink,
    or when to plug the syntax into.
    ie, is it a process, a validation, etc.
    Do you have any advice for me?

  • How to change the color of a font/sentence ?

    what is a quick and easy method to change the colour of a sentence?
    thanks!!!

    what are you asking here?
    i'm confused because your questions is so simple
    the answer is to set the color of the text before you render it out
    if you're asking how to change the color AFTER it's in an image, well you can't, not by using the API anyway, you'll have to do some magic

  • May I know how to change the color of texts inside the indicator box?

    Can anyone tell me how to change the color of texts inside the indicator box? I have tried to use property node but not really know how it functions.
    In fact, I am writing a program for which the number inside indicator on front panel will show red color if the measured value can't reach the requirement. I am using LabView 6.1 Professional
    Thank You for your attention!!!!!!

    Simply use a property node with "NumText.TextColor" and wire the correct color depending on your test result.
    The attached simple example (LV 6.1) lets you change it from the front panel. In your case, you would use your test output instead of a FP switch, of course. Message Edited by altenbach on 05-25-2005 09:05 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    TextColor.vi ‏18 KB

  • Jtable: How to change the color of an entire row?

    How can I change the color on an entire row in a Jtable based upon the value in one of the cells in that row.
    For example: Lets say:
    I have 5 rows. Each row has 4 columns.
    If column 4 has a value "A" in any of the rows, all the text in that row should be red.
    If column 4 has a value "B" in any of the rows, all the text in that row should be blue.
    Just point me in the right direction and I will try to take it on from there.
    Thanks

    In the future, Swing related questions should be posted in the Swing forum.
    But there is no need to repost because you can search the Swing forum for my "Table Prepare Renderer" (without the spaces) example which shows how this can be done.
    But first read the tutorial link given above.

  • How to change the color of a DateSpinner in Flex

    Please how can i change the color of a DateSpinner in Flex Mobile?

    i have the following code here in the renderer n while setting the value in the table how do i pass the value n in the renderer i only have the indexes of the row n col how to check for the value thats not in the table i have commented the code where ever required... kindly help me out with this problem
    <Code>
    private JTable table = new JTable(){
         public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
              Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
              if (!isCellSelected(rowIndex, vColIndex)) {//What else should i put in here to check the value
                   c.setBackground(Color.yellow);
              else {
                   c.setBackground(getBackground());
              return c;
    StringBuffer sql = new StringBuffer("Select * from table)
    int row = 0;
    table.setRowCount(row);          
    try {
    ResultSet rs = //execute SQL
    while (rs.next()) {
         table.setRowCount(row + 1);
         table.setValueAt(rs.getString(1), row, 0);
         //This is where i have to change the color
         if(rs.getString("ColumnName").equals("Something")){
              //Change the color of the current row
         row++;
    rs.close();
    catch (SQLException e) {
    </Code>

  • How to change the color of bar in bar chart

    Hi I'm
    using Crystal Reports 2005 with Visual Studio 2005. How do i change the color of the bar in a bar chart, i don't see any options, someone telling in the forum that i can simply right click on the bar and choose color, but i don't get that option. all i can select is the entire chart object.
    any help is greatly appreciated.
    Thanks
    yesvee

    You have to make sure that you select the correct part of the bar.
    For Example:   When you click on the outside of the chart, the entire chart will be selected. Clicking somewhere inside the chart will also highlight the entire chart, but to highlight a specific bar or line you have to click until only that part is highlighted.
    Once you have the bar or series highlighted, right-click on the highlighted section and then select Chart Options, or "Format Series Riser" and you should be able to change the colour of the bar/line.

  • How to change the color of a bullet

    I'm new to InDesign CS3. I've figured out how to create a bullet list, even change the bullet to something custom. But I now want to change the color of the bullets. I want to keep the text black, but have the bullets be a different color. Can someone point me to the method to do this.
    Many, many thanks!

    I don't "want" anithing in particular, much less turning inDesign into MS Word I do believe UX could be improved making it more intuitive while keeping the advanced features of Style libraries that can be applied across pages of a large project. On that note I am quite aware of the differenced between inDesign and MSWord as someone who has been working in DTP though that's not a daily activity at this time
    How would the program know what you want? Would you want specific keystrokes to invoke some sort of treatment to your text?
    Maybe I should've been more specific and thorough, my bad... it's not by some magic spell that the program would know "what I want" nor I mentioned keyboard shortcuts to perform "some sort of treatment" to the text.
    Looks like we have a case of "what we have here is a failure to communicate" LOL! ...And is most llikely my fault... perhaps I haven't been clear and simple enough in my explanation of how I would envision a more intuitive UI which would make for a more friendly UX.
    Let me try again:
    The program knows that the item selected is a list because when selecting a bulleted list in inDesign that's what happens... it's not a new feature, it's already context-aware.
    To see what I mean create a text area, and type 3 lines of text, then turn it into a bulleted list by clicking the bullet list button.
    At this point select the list...
    You will notice that once you highlight the list, the bullet list button in the properties toolbar (the same that contains font size, paragraph, alignment buttons and so on) will turn "on" showing the typical selected sate with a darker gray gradient effect, to indicate that the bullet list is selected because that attribute is active on the text area created by the type tool...
    ... I hope the concept above is clear and it's a fact that the program knows not "what I want", which wasn't even the point.. but knows that the selected item is a bullet list made of text that the user has written to which the program attached default basic bulletpoints at each "new line"
    Now, since we can agree that we have one object (the text field) that has been associated with another object (the bullet points added by the program) it should also be clear which "two objects" I was referring to.
    At this point, both ourselves and the program are aware to have 2 objects... and as we know they have several modifiable properties such as size, color, font, and so on as previously mentioned.
    So with the above cleared out, we now have:
    Object userTypedText
    and
    Object programAddedBulletPoints
    We know that they both have mofifiable property such as color, fontFamily, fontSize and few others I'll skip for example sake.
    Back to my original point of simplifying, it really boils down to allowing the Object userTypedText and the object programAddedBulletPoints to be separately accessible by users allowing them to change the properties, much like already done when selecting the text and changing font size for instance.
    All I was talking about was simply to allow users to modify properties of bullets or index of a list via an inspector (a currently missing feature) that would let users access and modify right away the properties of the programAddedBulletPoints that at this time can only be modified via the process illustrated by Nilsy.
    If you imagine that one would need to go through the same style "workflow" to merely change the fontsize or font color, you would surely agree that would be nonsense and should be done by a more immediately user-accessible character panel... so that's what I am suggesting: to have a more immediately user-accessible bullet/index property panel to let users select and edit both unordered and ordered lists appearance without forcing users to resort to having to jump between multiple style-formatting windows buried in tabbed panes.
    I hope I've been able to illustrate what I meant in my original comment.
    Cheers!
    tfbkny

Maybe you are looking for

  • Disk permissions-should I be worried?

    Hey, I was just wondering if I should be worried about disk permissions. When permission repairing is completed and I press it again it repairs the same permissions again.. I tried searching but couldn't find as long permission error list as I have s

  • How do I watch livestream on iPad 4

    I'm trying to watch a sporting event on a local tv station but I am unable to do so on my iPad.  It works on laptop.  Is there an app I need to get for this?

  • IPhoto can't find pics - asks for each one individually

    I imported 750 pics from a CD, but didn't have the iPhoto "copy files to iPhoto library" turned on. When I went back to edit the photo's after I had ejected the disk, iPhoto couldn't find the files. I realized what I had done, so I remounted the CD,

  • 2 editable combobox questions

    1. addKeyListener(..) not working onto editable combobox. 2. how to scroll the editable combobox when user types into it? (in case of solving 1st problem, this one is solved too). Maybe there are special methods?? Thank you very much. Boris.

  • Component hot deployment..

    Does weblogic support hot-deployment wherein the (updated)ear file or the exploded directory structure can be placed in the file system, takes the newer version for the subsequent newer request and older requests are serviced through the older versio