cancel
Showing results for 
Search instead for 
Did you mean: 

ON_DATA_CHECK event for data validation in ALV

tom_peng
Explorer
0 Kudos

We have a web dynpro application that contains an ALV grid. We want to validate data that the user enters into this grid (no new rows or deleted rows, changed cells only).

First, we tried to use WDDOBEFOREACTION in the view. This doesn't work because the changes in the grid haven't been written back to the view context yet, so when you retrieve the view context, all you get are the old entries.

Next, we tried to use the ON_DATA_CHECK event from the used ALV component. This seems like the right place to do the checks, but the issue is that the modified entries only show up in R_PARAM->T_MODIFIED_CELLS the first time the user presses ENTER or CHECK. If the user presses ENTER or CHECK a second time, the system figures the cells didn't change, so T_MODIFIED_CELLS is empty, and our checks (which loop through T_MODIFIED_CELLS) don't work.

At the moment, we are using WDDOMODIFYVIEW in the view. At this point, changes in the grid have been written back to the view context, so we can just retrieve the context and do our checks.

Doing the checks in WDDOMODIFYVIEW "feels wrong" because we are validating data in an event intended for view changes. Has anyone come across this issue and used ON_DATA_CHECK successfully?

Thanks,

Tom Peng

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

Instead of getting the modified cells data from the parameteres of the event, try to map the Context Node DATA of the ALV Component to the context element of your controller. And on this event handler, try to loop at each element and call the method is_changed_by_client( ) on each element object.

When this is true, try to add this to the context node that you want to use further or set it as attribute at the view level and reuse that in another methods.

Regards,

Chiranjeevi.

tom_peng
Explorer
0 Kudos

Chiranjeevi,

Thanks for the reply. How do I access context nodes of the ALV component in the ON_DATA_CHECK event? I can access all nodes of the calling view, but I don't know how to access nodes of any used components.

Thanks,

Tom

Former Member
0 Kudos

Hi Tom,

In which way you are sending the data to the ALV component. Is it through model object of a Context mapping. If you are doing a context, the updated data will be in your context.

Regards,

Chiranjeevi.

tom_peng
Explorer
0 Kudos

You are saying that the changed data is already updated in the context node of the calling view by the time you get to ON_DATA_CHECK, right? Yes, that is true, and if we write the checks that way, it's exactly the same as how we are doing it in WDDOMODIFYVIEW. Can you see any advantage to doing the checks in ON_DATA_CHECK instead of WDDOMODIFYVIEW?

Thanks,

Tom