OO ALV - How to highlight cell after value change

Hi All,
I have an OO ALV with an input enable column and would like to highlight a cell in a different color when the user changes it's value.
I am using pr_data_changed->get_cell_value to check the cells value has changed and pr_data_changed->modify_cell to update the cell with the new value.
The output table has a field called CELLCOLOR of type LVC_T_SCOL which I am using to highlight the cell in red:
         lw_cellcolor-fname = 'THISFIELD' .
         lw_cellcolor-color-col = '7'.
The ALV layout is also correclty set using:   layout-ctab_fname = 'CELLCOLOR'
All the above is working fine and the changed cell is highlighted HOWEVER it only works if I call METHOD g_grid->refresh_table_display
Is there anyway to highlight the cell without calling method refresh_table_display??????
I do not like to call method refresh_table_display in an ALV event. The main reason is if a user changes a cells value and at the same time selects the row for update then the method refresh_table_display wipes out the row selection marker.
So Is there anyway to highlight the cell without calling method refresh_table_display??????
All your help appreciated
Che

Try this way
In the PAI use
call method get_selected_rows
This will get you the row index of the selected rows from the screen for example I_ROW
In PBO
call method g_grid->set_selected_rows
exporting
  it_row_no = i_rows[].
then call refresh_table_first_display
So this one will keep row selection after the refresh_table_first_display method

Similar Messages

  • ALV: How do I suppress repeating values and page breaks on printed output?

    Good day, everyone!
    First, I've done a LOT of searching trying to find the answer to my question, but I'm not finding an answer.  If this has already been answered and you can point me to a URL, I would appreciate it.
    Here's my issue:  I have a rather simple ALV report.  It has the columns of Person ID, Personnel Number, For Period, In Period, and Amount.  I sort by Person ID and Personnel Number, and if the value repeats on the next line of the report, I want to suppress it (make it blank).
    I thought the answer was in the following code, where I set the GROUP attribute to asterisk:
      CLEAR sortcat_ln.
      sortcat_ln-spos      = '1'.
      sortcat_ln-fieldname = 'PERSONID_EXT'.
      sortcat_ln-up        = c_true.
      sortcat_ln-group     = '*'.
      APPEND sortcat_ln TO sortcat.
      CLEAR sortcat_ln.
      sortcat_ln-spos      = '2'.
      sortcat_ln-fieldname = 'PERNR'.
      sortcat_ln-up        = c_true.
      sortcat_ln-group     = '*'.
      APPEND sortcat_ln TO sortcat.
    It looks PERFECT on the screen -- the values are suppressed if they repeat, and everything appears together on one screen.  However, when I print the report, two things happen:  1) The values repeat on each row, even if they are the same, and 2) I get a page break after each Person ID / Personnel Number combination.
    I now realize that I can't use the GROUP attribute.  Is there some other way in ALV to blank these repeating values and keep all the rows together on one page, rather than page breaking after each value change?
    Thanks!
    Dave

    Hi
    Same requirement i had before, when i try to print preview. the output of the grid display is in grouping is ok, but when i print preview or print it doesnt cater the grouping and page breaks, so what i did i modify the internal table use in alv , after hitting the print preview/print with the format desired by the user. you can do that in user-command. see code below
    FORM user_command USING r_ucomm TYPE syucomm
                            rs_selfield TYPE slis_selfield.
      DATA lt_sort TYPE lvc_t_sort.
      CASE r_ucomm.
        WHEN '&RNT_PREV' OR '&RNT'.
          t_final_x[] = t_final[].
          PERFORM clear_redundant.
          PERFORM set_sort_criteria USING lt_sort.
        WHEN '&F03' OR '&PRINT_BACK_PREVIEW'.
          t_final[] = t_final_x[].
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "user_command
    hope it helps

  • How to write rfc when value change in the screen (browser) in webdynpro.

    Hi,
    I want to know how can i write an RFC when screen value change in webdynpro. I already designed a rfc where all the value can be seen in the webdypro screen. Now when user change the value how can i pick the changed value in R/3 so that i can save it into the respective database.  Please send some code for understanding it easily as i am new to this field.
    Regards
    Deep

    Hi Deepak,
    Though I dint understand your requirment properly but as it is raised in Web Dynpro forum I considering that you want to send the data filled by the user to your backend using RFC calls. For this purpose you can refer to this two documents available on SDN.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/creating%20a%20web%20dynpro%20application%20accessing%20abap%20functions.pdf">Tutorial 4</a>
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d352a790-0201-0010-5082-b1a608d22b6c">Tutorial 5</a>
    Regards
    Sid

  • Can't highlight cells after using CellRenderer

    I have used a CellRenderer for my column to change its background color but after i have set it i wasn't able to highlight any cell at my JTable. please help.
    CellRenderer code:
    class JJCellRenderer
    extends DefaultTableCellRenderer
    private int arrVerifyColumns[] = null;
         Color MyColor;
    public JJCellRenderer(Color x)
    MyColor = x;
    }//end constructor
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column)
         this.setValue(String.valueOf(value));
         this.setFont(new Font("Arial", Font.PLAIN, 12));
         this.setSelected(isSelected);
    this.setBackground(MyColor); // All columns verified were empty - set our background RED
    return this;
    }//end getTableCRC
    }//end class JJCR

    i would be pleased if you could let us take part of your solution.
    i have a problem in the same manner like yours - just that i call my Editor-/RendererComponents from outside like:
    public class MainWindow extends javax.swing.JFrame implements Searchable {
      public void find (Criteria crit) {
         for(int i=0; i<documentTable.getRowCount (); i++) {
          Object v = null;
            String vs = "";
            v = documentTable.getModel ().getValueAt (i,0);
            if(v!=null) {
              vs = v.toString ();
            if(vs.matches (crit.getExpression ())) {
              ((javax.swing.JTextField)documentTable.getCellEditor (i,0)
              .getTableCellEditorComponent (documentTable, v, false,
                          i,0)).setBackground (getSearchHighlightedBackgroundColor ());
    }i have tried many other variations of this snippet like CellRenderer instead of CellEditor
    or miscellaneous derived implementations of CellRenderer and CellEditor, other components - and hereafter leading to - other casts and other hightlighting-formats such as setFont and also repaint()ing after this.
    the best result was a changing color/font after the party should be over (means: while focusing other rows after closing the searchDialog).
    one possible way to explain this could be one shared component referenced by the return of getTableCell...Component(...) but a
      return new JTextField(val);
      // ...inside of this method should make clear that there is no object being shared.
    the search for a solution continues ...
    best regards
    tb

  • How to highlight the selected value in a table

    Hi All,
    I have list of roles in a table like admin,dba...etc.
    i will select the current selected role using
      Stgin role =wdCotext.currentElement().getRole();
    After getting the role i bind this value in context.
    now my requiremnet is i will navigate to other table view containing all roles like admin,dba,networkadmin .
    I have to highlight the selected role in previous table to new table containing the  all the roles.
    means selected role should be highlight in a next table view list of roles.
    please help.

    Hi mohammad,
    To achieve this functionality, use another integer variable to store the index of the currently selected element in the first view. Pass this variable's value to the next view (either as plug parameter or throgh mapping) and set the Lead selection for the table as this index in the second view.
    In the first View ....
    int n = wdContext.current<your_node>Element().index()
    pass this value from first view to second view.
    In the second view
    wdContext.node<your_node>().setLeadSelection(n)
    Hope this helps,
    Best Regards,
    Nibu.
    Message was edited by: Nibu Wilson

  • How to highlight cell in a tree programatically when mouse arrow is moved over it

    Hi
       I would like to highlight a particular cell in a tree when a mouse arrow is moved over it. Similar to wndows drop down menu. Can anybody help me on these.
    Regards
    Bharath
    Solved!
    Go to Solution.

    But I find an issue with this. When there are items with same values in the tree, it always points to the first matched value (even if I set the active item tag to the one where I want to point to). For example, if I have  a tree with values "Hello, Hi, Bye, Hello" and then I set the value to "Hello", it points to the first "Hello" even if I set the tag to the second yellow. Do you know any easy work around for this? Thank you!
    jcarmody wrote:

  • JTable, how to highlight cells with tooltips?

    Hello all!
    Mine problem is descriped in the topic - I though about custom cell renderer but I dont have an Idea how to change background for many other cells in other rows and don't change background in whole columns. Any of You could help?

    Hey thanks for replying.
    With code like that:
    public class yellowCellRenderer
      extends DefaultTableCellRenderer
      private int whichRow = 0;
      public yellowCellRenderer(int saveToRow)
        this.whichRow = saveToRow;
      public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column)
        if(this.whichRow == row){
         this.setBackground(Color.YELLOW);  // All columns verified were empty - set our background RED
        return this;
    }and usage:
         comments.add(comment);
         JTable table = getMainTable();
         TableColumnModel colModel = table.getColumnModel();
         for(int i=0;i<comment.length;i++){
             if(!Main.isStringEmpty((String)comment)){
              TableColumn column = colModel.getColumn(i);
              column.setCellRenderer(
                   new yellowCellRenderer(table.getRowCount()-1)
    Every each cell in column gets yellow background... What am I doing wrong?

  • ADF: How to highlight cell(s) in chooseDate component

    Hi,
    I am using "ADF: ChooseDate" component for my application. Based on certain condition(s), I want to highlight a Date/Cell in the chooseDate calendar. I also want to customize the color for certain date (based on some conditions). I could not find a way to do it, Can someone please guide me.
    Purpose of doing this: I want to design an application so that user can choose specific date (from calendar) for scheduling tasks. Once a task is created for a specific date then calendar should have some way of notifying user that some task(s) is/are already scheduled for specific dates. Thats why I am looking at a solution when dates can be highlighted (if there is any task scheduled for a particular date).
    Best Regards,
    Ajay

    I'd speculate that the chooseDate component does not have the functionality you require. For this sort of funtionality I'd suggest you'd have to build your own component.
    Not that is solves your problen, but if you're using JDev 11g, note that the ADF Faces RC chooseDate component does have attributes for disabledDaysOfWeek and disabledMonths.
    CM.

  • How to track column level value change in oracle using procedures

    I would need to write the below code using oracle stored procedures & packages.
    DBA hates triggers so i cant enforce the same code.
    Please help me out to achieve the same. thanks in advance.
    if i do DML on master table (emp) , the audit should go to the emp_audit.i have used triggers but oracle DBA dont want to use triggers. Please guide me.
    Master table : emp
    column 1 : emp_id
    column 2 : salary
    create or replace TRIGGER test
    AFTER INSERT OR UPDATE OR DELETE ON emp
    FOR EACH ROW
    BEGIN
    IF INSERTING THEN
    INSERT INTO emp_audit
    (emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
    VALUES (
    :NEW.emp_id,
    :NEW.salary,
    :NEW.CREATED_TS,
    :NEW.CREATED_user,
    :NEW.MODIFIED_TS,
    :NEW.MODIFIED_usER,
    systimestamp, 'C'); -- INSERT
    ELSIF UPDATING THEN
    INSERT INTO emp_audit
    (emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
    VALUES (
    :OLD.emp_id,
    :OLD.salary,
    :OLD.CREATED_TS,
    :OLD.CREATED_user,
    :OLD.MODIFIED_TS,
    :OLD.MODIFIED_usER,
    systimestamp, 'U'); -- UPDATE
    ELSIF DELETING THEN
    INSERT INTO emp_audit
    (emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
    VALUES (
    :OLD.emp_id,
    :OLD.salary,
    :OLD.CREATED_TS,
    :OLD.CREATED_user,
    :OLD.MODIFIED_TS,
    :OLD.MODIFIED_usER,
    systimestamp, 'D'); -- DELETE
    END IF;
    END;
    thanks,
    bala

    i am sorry.
    we can't change master table emp structure.
    Audit table would be emp_audit.
    Please guide me to write some generic procedure to handle the audit , what ever insert/update/delete.
    Please do the needful. thanks in advance.
    Master table : emp
    column 1 : emp_id
    column 2 : salary
    Audit Table : emp_audit
    columns:
    emp_id ,
    salary,
    created_ts,
    CREATED_user,
    MODIFIED_TS,
    MODIFIED_usER,
    archived_ts,
    event_cd
    create or replace TRIGGER test
    AFTER INSERT OR UPDATE OR DELETE ON emp
    FOR EACH ROW
    BEGIN
    IF INSERTING THEN
    INSERT INTO emp_audit
    (emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
    VALUES (
    :NEW.emp_id,
    :NEW.salary,
    :NEW.CREATED_TS,
    :NEW.CREATED_user,
    :NEW.MODIFIED_TS,
    :NEW.MODIFIED_usER,
    systimestamp, 'C'); -- INSERT
    ELSIF UPDATING THEN
    INSERT INTO emp_audit
    (emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
    VALUES (
    :OLD.emp_id,
    :OLD.salary,
    :OLD.CREATED_TS,
    :OLD.CREATED_user,
    :OLD.MODIFIED_TS,
    :OLD.MODIFIED_usER,
    systimestamp, 'U'); -- UPDATE
    ELSIF DELETING THEN
    INSERT INTO emp_audit
    (emp_id , salary,created_ts,CREATED_user,MODIFIED_TS,MODIFIED_usER, archived_ts, event_cd)
    VALUES (
    :OLD.emp_id,
    :OLD.salary,
    :OLD.CREATED_TS,
    :OLD.CREATED_user,
    :OLD.MODIFIED_TS,
    :OLD.MODIFIED_usER,
    systimestamp, 'D'); -- DELETE
    END IF;
    END;
    thanks,
    bala

  • How to find number of values change in one transaction?.

    11gr2.
    RHEL 5.
    i have a batch job which is changing records in table now i want to find that per transaction how many values are changed?.

    Hi Asad,
    v$sess_io can be referred ..
    set line 900
    set pages 900
    alter session set nls_date_format='dd-mon-yy hh24:mi:ss';
    select b.SID,b.serial#,a.BLOCK_CHANGES,c.sql_text,b.logon_time,a.consistent_changes,b.username,b.status,round(b.last_call_et/60,0) Min,vp.spid,sw.event
    from v$sess_io a,v$session b,v$sqlarea c,v$process vp,v$session_wait sw
    where b.sql_address=c.address
    and a.sid=b.sid and b.paddr=vp.addr and b.sid=sw.sid
    and rownum < 10
    order by a.BLOCK_CHANGES desc;Thanks,
    Ajay More
    http://www.moreajays.com

  • How to update and save values changes during run time

    I have string and numeric controls on my front panel that the operator can change the values of and was wondering if there was any way to save these changes everytime the vi was closed so they would stay current???
    thanks
    dale walker
    [email protected]

    If you want to change the default settings, its a little involved, mainly because your editing a control's settings while in 'run' mode, but study the example in the below link to get you going.
    Another method is to write your values in a text file. This could be part of your closing routine before actually stopping the VI's run. Then, upon the next running of the VI, your initiating routine would involve reading the text file to populate your controls/indicators. I often use these text files because users can easily view them with Wordpad, etc., as needed, without needing labview on their PC.
    Good luck with it, Doug
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&2C14132F826F839F8625683A000B0B99&cat=DB5863CD70417B07862567930070A058

  • How to restore picture after saving changes ?

    Is there any chance to restore a picture I already saved cropping? Time machine wasn't setup.

    If you did it in Preview, did you try 'Revert Document...'?
    Ciao.

  • How to trigger value change in event structure

    Hii everyone, as the title, how should I trigger the value change event to pop up a message.. below is my connection..
    I want to trigger the event structure to pop up the sub-vi, when the flame and led are TRUE state... I using property node but still the event structure not able to execute.. How should I connect? Thank you very much...
    Solved!
    Go to Solution.

    There are several ways you can do it. First you have to configure your sub-vi so that it does whatever you want when it runs  (in the vi properties, top most window for example) and to make sure that it closes completely when finished (when clicking the "OK" button for example).
    You than need to make an asynchronous call to the sub-vi. There are several ways to do it. My favorite one is shown below. You go in the "Application control" sub-palette and select Static VI reference. I like this approach because it keeps track of the sub-vi path for you, as long as the sub-vi is in the same project. You then drag the sub-vi onto the empty square that will changes to your sub-vi icon. You then connect to an invoke node from the same sub-palette and select run VI. Set "Wait Until Done" to false and the main VI will keep running after starting the Sub vi. Set "Auto Dispose Ref" is the easiest way to go. Otherwise you have to keep track of the sub-vi reference and close it yourself when you're done.
    Marc Dubois
    HaroTek LLC
    www.harotek.com

  • How can I calculate the value of the cell, which depends on other rows?

    Hi, all!
    I have an application with table. In this table i have calculate some fields, that doesn't exists in data class and depends on other row values, e.g. current row number, or sum of previous rows. How can i calculate this values in TableView?
    The problem is that I have no information about the current row number in the cell value factory.
    Example:
    public class Transaction {
         public String getName();
         public BigInteger getAmount();
    } // There is no getter for "Balance"
    Result table should be something like this:
    Name
    Amount
    Balance
    transaction1
    300
    300
    transaction2
    200
    500
    transaction3
    500
    1000
    Also, after sorting by "Amount", "Balance" should be recalculated:
    Name
    Amount
    Balance
    transaction3
    500
    500
    transaction1
    300
    800
    transaction2
    200
    1000

    Strings can be converted to numbers by various parse methods. For instance Strings can be converted to double via Double.parseDouble(myString).
    That being said, it appears that your textfield will contain numbers and operators, and so these operators will need to be parsed too. I would advise you to search on the terms Java infix postfix.

  • How to know when the PRICE AFTER DISCOUNT changed and get the value

    Hi,
    Everything I do to see if a value changed in the grid works except for PRICE AFTER DISCOUNT
    which seems to be inaccessible.
    Any idea how to know when exactly this value changed and do actions accordinly ?
    Also I always get 0.00 if I try to get the value of it
    This works to get in the condition of a vlaue changing but I always get 0.00 as the value of the column
    if (pVal.ItemUID == "38" && pVal.ColUID == COL_DISCOUNT.ToString() && pVal.EventType == BoEventTypes.et_VALIDATE && pVal.ItemChanged == true && pVal.ActionSuccess == true)
        try
            SAPbouiCOM.Matrix Matrix = (SAPbouiCOM.Matrix)SBO_Application.Forms.ActiveForm.Items.Item("38").Specific;
            SAPbouiCOM.EditText Editor = (SAPbouiCOM.EditText)Matrix.Columns.Item(COL_DISCOUNT).Cells.Item(pVal.Row).Specific;
            SBO_Application.MessageBox("Discount changed for : " + Editor.Value + "...", 1, "Ok", "", "");
        catch (Exception ex)
            SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");
    And this do not even get into the condition even tought I SEE the column PRICE AFTER DISCOUNT:
    if (pVal.ItemUID == "38" && pVal.ColUID == COL_PRICEAFTERDISCOUNT.ToString() && pVal.EventType == BoEventTypes.et_VALIDATE && pVal.ItemChanged == true && pVal.ActionSuccess == true)
        try
            SAPbouiCOM.Matrix Matrix = (SAPbouiCOM.Matrix)SBO_Application.Forms.ActiveForm.Items.Item("38").Specific;
            SAPbouiCOM.EditText Editor = (SAPbouiCOM.EditText)Matrix.Columns.Item(COL_PRICEAFTERDISCOUNT).Cells.Item(pVal.Row).Specific;
            SBO_Application.MessageBox("Price after discount changed for : " + Editor.Value + "...", 1, "Ok", "", "");
         catch (Exception ex)
             SBO_Application.MessageBox(ex.Message, 1, "Ok", "", "");

    just idea, maybe it will works
    Create one udf in row level and set there FS based on changes on price after discount and fill value what is in price after discount. Then the validation make on this field instead of standard SAP field.

Maybe you are looking for

  • Trying to measure the degree of arc of two points

    I am trying to compute the degree of a mouse down and a mouse up, in order to rotate a rectangle. I always start rotation in the bottom right corner. I can get a trivial example to work as follows with vector2d: Vector2d start = new Vector2d( 400, 0

  • How to autoextend tablespace in Oracle 9i

    Dear All, I have currenctly a tablespace ABC. Database is failing to writing. I want to alter tablespace ABC and want to make its AUTOEXTEND ON. Could any body please suggest the SQL Query how to do this. Regards,

  • Hash Tables

    Hi, this is probably a strange request, but i have to write a hash table function from scratch. I have no idea where to start. apparently i have to store the hash values in linked lists somehow please help im desperately in need of some advie thankyo

  • Problem with os update from 4.3 to 4.5 on Curve 8330 Verizon

    Performed os update from 4.3 to 4.5 through "check for Updates" on blackberry's site.  checked box to have information backed up while updating and then restored after.  during update there was an error and the restore did not take, but phone was wip

  • Votre logiciel ne tient pas ses promesse aucun respect de la mise en page ne respecte pas la ponctuation merci de votre concours

    votre logiciel ne tient pas ses promesse de traduire du PDF EN TEXTE aucun respect de la mise en page, ne respecte pas la ponctuation merci de votre concours cela m'a couté 25 euros je ne sais même pas comment me désabonner c' est honteux. A VOTRE BO