How to change the selected row color in an alv grid display ?

Hello ,
I WANT TO CHANGE THE COLOR OF THE SELECTED RECORDS  IN AN ALV GRID DISPLAY ?
ITS URGENT..
WILL BE REWARDED...

hai   Ssnagh Samala 
EXicut This report >
Hope It Will  Meet U r Requirement.
If Found Helpfull Reward.
REPORT zcuitest_alv_07.
Use of colours in ALV grid (cell, line and column) *
Table
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.
START-OF-SELECTION.
PERFORM get_data.
END-OF-SELECTION.
PERFORM fill_catalog.
PERFORM fill_layout.
CALL SCREEN 2000.
*& Module status_2000 OUTPUT
text
MODULE status_2000 OUTPUT.
SET PF-STATUS '2000'.
ENDMODULE. " status_2000 OUTPUT
*& Module user_command_2000 INPUT
text
MODULE user_command_2000 INPUT.
DATA : w_okcode LIKE sy-ucomm.
MOVE okcode TO w_okcode.
CLEAR okcode.
CASE w_okcode.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " user_command_2000 INPUT
*& Module alv_grid OUTPUT
text
MODULE alv_grid OUTPUT.
IF w_docking_container IS INITIAL.
PERFORM create_objects.
PERFORM display_alv_grid.
ENDIF.
ENDMODULE. " alv_grid OUTPUT
*& Form create_objects
text
--> p1 text
<-- p2 text
FORM create_objects.
Ratio must be included in http://5..95
CREATE OBJECT w_docking_container
EXPORTING
ratio = 95
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.
ENDFORM. " create_objects
*& Form display_alv_grid
text
--> p1 text
<-- p2 text
FORM display_alv_grid.
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. " display_alv_grid
*& Form get_data
text
--> p1 text
<-- p2 text
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 '5' 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. " get_data
*& Form fill_catalog
text
--> p1 text
<-- p2 text
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. " fill_catalog
*& Form fill_layout
text
--> p1 text
<-- p2 text
FORM fill_layout.
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.
ENDFORM. " fill_layout
Regards.
Eshwar.

Similar Messages

  • How to change the selection background color of the selected item in the popup menu of the choice box ?

    How to change the selection background color of the selected item in the popup menu of the choice box ?
    By defaut, the selection background color likes "blue", but if I want it to be "yellow" for example, how should I do ?
    Thanks

    The id is applied by (I think) the skin class of the ChoiceBox. You don't need to define it.
    You have to apply the css in an external style sheet. You can apply the external style sheet to any parent of your choice box, or to the scene (the most usual way to do it).
    Example:
    import java.util.ArrayList;
    import java.util.List;
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.ChoiceBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    public class ChoiceBoxTest extends Application {
      @Override
      public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Example 2");
        final ChoiceBox<String> choiceBox = new ChoiceBox<>();
        List<String> tempResult = new ArrayList<String>();
        for (int i = 0; i < 10; i++) {
          tempResult.add("Item " + i);
        choiceBox.getItems().setAll(tempResult);
        VBox root = new VBox();
        root.getChildren().add(choiceBox);
        final Scene scene = new Scene(root, 300, 250);
        scene.getStylesheets().add("choiceBox.css");
        primaryStage.setScene(scene);
        primaryStage.show();   
      public static void main(String[] args) {
        launch(args);
    choiceBox.css:
    @CHARSET "UTF-8";
    #choice-box-menu-item:focused  {
    -fx-background-color: yellow ;
    #choice-box-menu-item .label {
    -fx-text-fill: black ;
    Message was edited by: James_D

  • How to change the selected tabPane title color in JTabbedPane

    how to change the selected tabPane title color(or set bold) in JTabbedPane.
    Any advice will be appreciate.

    Hi,
    try
    // Set text color for the selected tab
    tab.setForegroundAt(tab.getSelectedIndex(), Color.red);Hope that helps

  • How to delete the selected rows in a JTable on pressing a button?

    How to delete the selected rows in a JTable on pressing a button?

    You are right. I did the same.
    Following is the code where some of them might find it useful in future.
    jTable1.selectAll();
    int[] array = jTable1.getSelectedRows();
    for(int i=array.length-1;i>=0;i--)
    DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
    model.removeRow(i);
    }

  • How to identify the Selected row number or Index in the growing Table

    Hi,
    How to find the selected Row number or Row Index of growing  Table using Javascript or Formcalc in Interactive Adobe forms
    Thanks & Regards
    Srikanth

    After using bellow script it works fine
    xfa.resolveNode("Formname.Table1.Row1["this.parent.index"].fieldname").rawValue;

  • Can any one tell me how to change the current row header in FB1LN tcode

    Hi,
    can any one tell me how to change the current row header in FB1LN tcode.
    I want to show input date also in the layout.
    Regards
    Mave

    Hi
    I know two ways:
    - transaction obvu: here you can insert new fields, but only if these fields are included in certain table (like BKPF, BSEG, BSIS.....
    - if your field isn't included in those table, you have to modify the structure RFPOS and manage it in the BTE 1650. After updating RFPOS you have to run the program RFPOSXEXTEND to update the structure RFPOSXEXT.
    Max

  • How to change the line's color?

    In a linechart, if the backgroundColor of
    Application is not "#ffffff",there will be some white
    horizontal lines in the linechart. how to change the
    line's color?? thanks

    Hi, I hope this is what you are looking for:
    http://blog.flexexamples.com/2007/11/15/customizing-the-horizontal-grid-lines-in-a-flex-li nechart-control/

  • How can i  change the column label text in a alv table display

    how can i change the column label text in a alv table display??
    A similar kinda of question was posted previuosly where the requirement was the label text was needed and following below code was given as solution :
    <i>*  declare column, settings, header object
    DATA: lr_column TYPE REF TO cl_salv_wd_column.
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    DATA: lr_column_header type ref to CL_SALV_WD_COLUMN_HEADER.
    get column by specifying column name.
    lr_column = lr_column_settings->get_column( 'COLUMN_NAME1' ).
    set Header Text as null
    lr_column_header = lr_column->get_header( ).
    lr_column_header->set_text( ' ' ).</i>
    My specific requirement is i have an input field on the screen and i want reflect that value as the column label for one of the column in the alv table. I have used he above code with slight modification in the MODIFYVIEW method of the view since it is a process after input. The component gets activated without any errors but while run time i get an error stating
    <i>"The following error text was processed in the system CDV : Access via 'NULL' object reference not possible."</i>
    i have checked in debugging and the error occured at the statement :
    <i>lr_column = lr_column_settings->get_column( 'CURRENT_YEAR' ).</i>Please can you provide me an alternative for my requirement or correct me if i have done it wrong.
    Thanks,
    Suri

    I found it myself how to do it. The error says that it is not able to find the reference object i.e  it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
      DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
             lr_if_controller  TYPE REF TO iwci_salv_wd_table,
             lr_cmdl   TYPE REF TO cl_salv_wd_config_table,
             lr_col    TYPE REF TO cl_salv_wd_column.
      DATA : node_year  TYPE REF TO if_wd_context_node,
             elem_year  TYPE REF TO if_wd_context_element,
             stru_year  TYPE if_alv_layout=>element_importing,
             item_year  LIKE stru_year-i_current_year,
             lf_string    TYPE char(x),
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    Get the entered value from the input field of the screen
    node_year  = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
    elem_year  = node_year->get_element( ).
      elem_year->get_attribute(
       EXPORTING
        name = 'IMPORT_NODE-PARAMETER'
       IMPORTING
        value = L_IMPORT_PARAM ).
      WRITE L_IMPORT_PARAM TO lf_string.
    Get the reference of the table
      lr_cmp_usage  =  wd_this->wd_cpuse_alv( ).
      IF lr_cmp_usage->has_active_component( ) IS INITIAL.
        lr_cmp_usage->create_component( ).
      ENDIF.
      lr_if_controller  = wd_this->wd_cpifc_alv( ).
      lr_column_settings = lr_if_controller->get_model( ).
    get column by specifying column name.
      IF lr_column_settings IS BOUND.
        lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
    set Header Text as null
        lr_column_header = lr_column->get_header( ).
        lr_column_header->set_text( lf_string ).
    endif.

  • Check box als column in a standard table, how to get the selected row

    Dear experts,
    I habe standard tablt with check box as column. Now I want to get the current selected row structure and do some changes. How could I solve this problem? till now I just know to get the structure via lead selection.
    lo_node->get_element().
    lo_element = lo_node->get_static_attributes ( static_attributes = ls_row).
    How could I get the element through check-box in stead of lead selection. Many thanks!

    check this code
    To get the selected row number
    data: lr_element type ref to if_wd_context_element,
              lv_index type i.
      lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT'  ).
      lv_index = lr_element->get_index( ).
    Thanks
    Bala Duvvuri

  • How to change the Hyper links color in the XML form

    HI SDNs
    Do u have any idea how to change the hyperlink color in the xml form. My requirement is as follows.I have created xml form by using xml template and i displayed this xml form by using Km document iview.  I need tochange the hyper link color in the xml form content. I dont want to go for manual process by editing the xml form. because i have several hundreds of xml forms.
    Appreciate if you give suggestion.
    Thanks
    Ramana

    Hi Ramana,
    The most convenient way to change the hyper links is by using the Theme Editor. Go to System Administration --> Portal Display --> Select Theme --> Component-Specific Styles --> Links --> Function/Result Link.
    Hope this helps.
    Kind regards,
    Joost

  • How to delete the selected rows with a condition in alv

    dear all,
    i am using the code in object oriented alv.
    WHEN 'DEL'.
    PERFORM delete_rows.
    FORM delete_rows.
    DATA : lv_rows LIKE lvc_s_row.
    data : wa_ROWs like LVC_S_ROW.
    FREE : gt_rows.
    CALL METHOD alv_grid->get_selected_rows
    IMPORTING
    et_index_rows = gt_rows.
    IF gt_rows[] IS INITIAL.
    MESSAGE s000 WITH text-046.
    EXIT.
    ENDIF.
    loop at gt_rows into wa_ROWs .
    if sy-tabix ne 1.
    wa_ROWs-INDEX = wa_ROWs-INDEX - ( sy-tabix - 1 ).
    endif.
    delete gt_sim INDEX wa_ROWs-INDEX .
    endloop.
    the rows to be deleted from int.tab gt_sim not in the alv display.
    all the rows should not be deleted if one of the field in gt_sim eq 'R'.
    how to check this condition

    dear jayanthi,
            ok if i am coding like that as u mentioned ,
              it will exit the loop when first time the field value is 'R'.
      if any of  the selected rows contains  field value 'R'. it shold not delete all the selected rows.
    as u suggested it will not delete after first time the field value is r.
    i am deleting it by tab index so,
    suppose if i am selecting the row without field value R say its tabix is 1.
      the next row with tabix 2 with field value R.
      it deletes the first row and exits , it should not delete the first row also.

  • How to get the selected rows & columns in the table?

    hi everybody,
                         In my application the table is kept inside the event structure.I select the cells  in the table (using mouse) on running time.How to get the selected number of rows & columns in that table?

    Hello,
    You can fill selected values of the table by writing to it or the corresponding property using a property node - the table is just a 2D array of strings.  I think for your "disable" question you are referring to the shortcut menu (when you right click).  If you are using LabVIEW 8.x, you can edit or disable that shortcut menu - just right click on your table at edit time and choose Advanced >> Run-Time Shortcut Menu.
    Best Regards,
    JLS
    Best,
    JLS
    Sixclear

  • How to Highlight the selected row of table

    Hi All,
    I have a result table. I want the selected row to be highlighted in orange color.
    The properties of the table are as follows :
    rowSelectable : true
    selectionChangeBehaviour : auto
    selectionMode : auto
    Please let me know what am I missing.
    Nikhil

    Hi Nikhil,
                 We too encountered this problem in EP 6.0. The code is correct. Actually
    int index=wdContext.nodeSales_Orders1().getLeadSelection();
    is enough.
    But this is not the problem. It is the problem with  either browser or Portal Runtime.
    Is your version EP 6.0? Is this a problem for all tables or only this table? Check with other browsers like Mozilla..(or different IE versions).
    regards,
    Siva

  • How to get the selected rows in a table

    Hi,
    How to get the ids of all the selected rows. On Page load a query is executed that shows the data in a table with a checkbox in the first column to select the rows and delete. Now if a user select multiple rows how do I get the ids of selected rows in the backend code.
    Thanks

    Please search the forum before posting questions.
    refer following thread for table selection.
    Re: Record selection with MessageCheckBox and print the selected record.
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                           

  • How to change the selections in selection screen

    Hello all,
    while executing web report we are getting a selection screen initially.
    1.problem is when we want to change the selections how to procedure after .
    when i went to variable screen it is filtering the exciting report. but i want to change the selection.
    2.when i run the query in Excel i can see the report as below
                            Cust1      Mat1      100
                            Cust1      mat2       20
    but when i run in web it is showing as below
                         Cust1     Mat1   100
                                      Mat2     20
    how can i get Cust1 for both Mat1&Mat2 in Web
    Thanks in Advance
    Sandy

    Hi Sharan,
    This is Ram, i have been watching this Thread, and tried to solve this problem in the Web to one of my query which i have created for testing purpose.
    See dont have much knowledge on WAD, but as the main owner was doing in his case , i am also doint the same way :
    Ex: i created the query in the query designer and there i know each and very property how to supress the repeated key etc etc, and i know it even in the Web browzer.
    However what i do is i open the query and click on change query and my query is displayed in the query designer and from there you click on the check mark in the top left for executing the query, but insteard of that click on the icon which takes you to the BROWZER.
    I usually do like that, but what you told in WAD i did not understand it at all, so can you give me more steps on how to open that in WAD and make the settings please...
    Regards,
    Ram Pawan

Maybe you are looking for

  • Weblogic 9.2 ESB integration with Websphere MQ 6.0 throws MQJMS1016

    Hi           We have setup a Websphere MQ integration where we have a weblogic server as the client.           The MQ setup is a clean MQ installation no WAS is installed.           Here are the MQ information           OS: Windows 2003 R2 Entreprise

  • Ipod break down wireless lan

    Hello everybody, i have a problem with my new iPod touch 4. I have a wireless network with 2 laptops and want to integrate my iPod. When I activate the wireless lan of my iPod and my laptop is on the net, everything is ok. If my laptop isn't on the n

  • Function Does Not Return any value .

    Hi , I am wrtting the below funtion without using any cursor to return any message if the value enters by parameters does not match with the value reterived by the function select statement or it does not reterive any value that for the parameters en

  • NWDS - Import types

    I have a question about the Netweaver Developer Studio which is hopefully apprpriate here- I didn't see a better forum for this question... I have 2 systems with NWDS installed- my laptop and a desktop system.  For some reason the leptop is only show

  • Alv report subtotals error

    hai friend iam imple menting alv grid report in that iam getting dump error how can i solve this problem iam posting my program pls any bady can help me pls the program is REPORT ZZ_TEST2 . TABLES : KNA1,LFA1,LFB1,BSIK. TYPE-POOLS: slis.