cancel
Showing results for 
Search instead for 
Did you mean: 

ON_DATA_CHECK doesn't trigger when data changes using button-on_function

Former Member
0 Kudos

Hi,

I have an Editable ALV in which I have checkboxes editable column.

When I manually click these check boxes my event handler ONDATASCHECK which has event ON_DATA_CHECK is getting triggered via a submit button which has event SAVE.everything is fine here is below code.

method ONACTIONSAVE .

DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
* Check for changes
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->data_check( ).

endmethod.

I had to place a button for select all on header bar of ALV for checkbox column.

I did this using event handler ONFUNCTION which has event ON_FUNCTION.

When i use this function as data is now changed I expected that automatically ON_DATA_CHECK will be triggered but it is not doing so.

What could be the reason?

Rgds

Vara

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Vara,

Try place the code which you had placed inside your SAVE under your WDDOAFTERACTION method. This way whenever you perform any action on the ALV this would check if any data has changed inside the ALV & trigger the ON_DATA_CHECK event of ALV. Within this method you can just set a flag variable at context level if the data has changed. So now within your SAVE button you would just have to check the flag to see if any data had changed & only then save the changes on to the database.

Regards,

Uday

Former Member
0 Kudos

Uday,

As suggested I have placed following code in WDDOAFTERACTION method.

DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
* Check for changes
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->data_check( ).

There are totally 3 buttons in my WD Application

button1- is selection-screen search which gets ALV (SEARCH METHOD)

button2 - is used for Select all check boxes ( ON_FUNCTION event )

button3 - submit to sap to update database ( SAVE method)

I have placed a break-point on l_ref_interfacecontroller->data_check( ) in WDDOAFTERACTION .

& Also placed a break-point in ON_DATA_CHECK method.

1) When I click manually check box it is stopping at WDDOAFTERACTION & ON_DATA_CHECK method and updating database succesfully which is not user friendly because i want this option only when user clicks Button3 -which submits to SAP.

2) when I use Button2(check boxes button) for selecting check boxes it still goes through WDDOAFTERACTION first time but it is not stopping at ON_DATA_CHECK method.Which is what I need Now After I click Button3 -SAVE database with all check boxes checked it is still going through WDDOAFTERACTION but it is not stopping at ON_DATA_CHECK method. it is not determining changes..

Can we determine in WDDOAFTERACTION or in SAVE method whether user pressed Select-all boxes button2 or user just checked it manually? then this could help me in placing code.

What could be still possible solution?

rgds

Vara

uday_gubbala2
Active Contributor
0 Kudos

Hi Vara,

This is because the ON_DATA_CHECK is designed to only keep track of any modifications that the user might do with the ALV directly (manually). Any changes done through coding wouldn't be reflecting in here. This is the way it has been designed.

Regards,

Uday

Former Member
0 Kudos

Thank you uday.

This has been resolved.What i did i used a different submit button for select all option.

depending on user clicks ia m hiding the manual button with wdui_visibility.

Rgds

Vara

Former Member
0 Kudos

Hi Vara,

I have exactly same problem. I have select all button in ON_FUNCTION to select all the check boxes and i cleck the submit button to release all the Purchase order ( update the database). But on_data_check is not getting triggered.

Can you please give me the details how you fixed.

Thanks,

Venu

Answers (0)