cancel
Showing results for 
Search instead for 
Did you mean: 

On Change or On Toggle Action of Checkbox in ALV

Former Member
0 Kudos

Hi,

i have a checkbox column in alv and i want to update database which checkbox of which row is changed so i must create an on changed or on toggle action for checkbox of alv.

How can i create an on changed or on toggle action for checkbox of alv?

or is there anyway else?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Nurullah,

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

Former Member
0 Kudos

Thank you very much Uday,

it worked.

Thanks again.

Answers (2)

Answers (2)

Former Member
0 Kudos

solved

Former Member
0 Kudos

I guess in your requirement ON_DATA_CHECK event is best suitable not onToggle. Implement this event and then on button you will have the results which row is modified. OnToggle event is used whenever you click on checkbox. This is what you want on every click you want to write to db. This is not practical approach. I think ondatacheck can solve your prob. To implement ondatacheck you can search the forum, there are alot of threads to implement this functionality.

Thanks,