Skip to Content
avatar image
Former Member

Detect when a cell has changed in ALV

Hello everybody,

the question is quite simple, is it possible to know when a cell has changed inside an alv. What I want to know is when a user change a value in any of the ALV's cells.

Is it possible? I think that maybe using an event, but I'm not sure of which

Regards,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Nov 18, 2008 at 05:17 PM

    Hi Javier,

    you can use event ON_DATA_CHECK.

    In the implementation of this event, you can see in r_param inserted, deleted and modified rows.

    R_PARAM->T_INSERTED_ROWS

    R_PARAM->T_DELETED_ROWS

    R_PARAM->T_MODIFIED_ROWS

    Also have a look at this [Editing ALV in Web Dynpro for ABAP|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1]

    Regards,

    Andreas

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Javier,

      This functionality is quite possible. You need to create an event handler method (say for example CHECK_DATA_CHANGE) for the event ON_DATA_CHECK of the ALV.

      You would have to first call the DATA_CHECK method of the ALV component. This method checks if any data has changed in the ALV and then triggers the ON_DATA_CHECK event if it finds that something has changed in the ALV. Create an eventhandler method for the ON_DATA_CHECK method and within this method enable your SAVE button for the user.

      Call this DATA_CHECK method from WDDOAFTERACTION so that whenever any action is performed the system would check if any data has changed in the ALV & then eventually execute your eventhandler method resulting in the button getting enabled. Hope that this is clear for you now.

      method WDDOAFTERACTION .
        DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
        lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
      
        lo_interfacecontroller->data_check( ).
      endmethod.

      Regards,

      Uday

  • avatar image
    Former Member
    Nov 19, 2008 at 08:05 AM

    Hi Javier,

    you can use the method set_data_check with parameter '01' in the WDDOINIT of your view.

      data lo_value type ref to cl_salv_wd_config_table.
      lo_value = lo_interfacecontroller->get_model( ).
    
    * To enable Data_Check when any records are changed by the user.
      lo_value->if_salv_wd_table_settings~set_data_check( '01' ).
    

    (if you need more source code, just let me know!)

    01 = DATA_CHECK_ON_CELL_EVENT

    02 = DATA_CHECK_ON_CHECK_EVENT

    99 = DATA_CHECK

    [http://help.sap.com/saphelp_nw70/helpdata/EN/96/20cca12f3c4bf59597c5cbfa00388d/frameset.htm]

    Regards,

    Andreas

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      I am working with this right now. However, I have the problem that it responds to clicking the standard button "Append Row" whereas it should respond to a change of cell content.

      You list these, but is this the complete list ?

      01 = DATA_CHECK_ON_CELL_EVENT

      02 = DATA_CHECK_ON_CHECK_EVENT

      99 = DATA_CHECK

      BR

      Peter