2009 Jun 22 11:07 AM
Hi there,
I have a grid table being filled of which I know, that it doesn't contain all necessary data to allow the user to continue.
As there are no mandatory flags to the fields I want to call a method (e.g. SET_DELTA_CELLS: it's marked INTERNAL only and doesn't seam to work anyway) to emulate user input or just trigger the event DATA_CHANGED.
I also thought about using method ADD_ROWS, but I don't need excess rows that I need to remove again.
What other possibilities are there?
2009 Jun 22 2:52 PM
The internal method 'set_delta_cells' is working for me. I've figured out, the best way should be to do call the method 'check_changed_data' before and after you call it.
This is what I'm doing:
1. Call 'check_changed_data' to get all fields changed by the user to the internal table.
2. Search internal table for wrong (initial in my case) fields which are not changed by the user and call 'set_delta_cells' for them.
3. Call 'check_changed_data' again, and now the fields are processed in the data changed event.
Use the method CHECK_CHANGED_DATA of the CL_GUI_ALV_GRID.
Like:
o_alv->check_changed_data(
IMPORTING
e_valid = lf_valid ).
This method calls the SAVE_DATA and in turn SAVE_DATA will trigger the DATA_CHANGED event.
Regards,
Naimesh Patel
2009 Jun 22 11:14 AM
hello alan ,
what u can do is when user press ENTER on the screen then u can call methid check_data_changed.
u can trigger that event only when user enters do some actions like ENTER or any other Function Codes.
user_command.
case 'ENTER'.
*---LOCALS.
data: l_stable type lvc_s_stbl.
*---refresh locals.
clear: l_stable.
call method g_grid%->check_changed_data.00-->in this method u can do validations based on the user inputs.
*---softrefresh.
l_stable-row = 1.
l_stable-col = 1.
call method g_grid%->refresh_table_display
exporting
is_stable = l_stable
i_soft_refresh = 'X'.
regards
Prabhu
2009 Jun 22 11:51 AM
Hi Prabhu,
thanks for your answer.
Alas, it would require the user to actively change a field and press ENTER or change a cell in order for DATA_CHANGED to being fired.
The point is, that I need to check certain data independent of user action (change of cell data). If the user presses the save/ok/continue button he must not be allowed to continue unless all data of the grid is filled where required.
regards
Alan
2009 Jun 22 3:03 PM
>
> Hi Prabhu,
>
> thanks for your answer.
> Alas, it would require the user to actively change a field and press ENTER or change a cell in order for DATA_CHANGED to being fired.
>
> The point is, that I need to check certain data independent of user action (change of cell data). If the user presses the save/ok/continue button he must not be allowed to continue unless all data of the grid is filled where required.
>
> regards
> Alan
Hi Alan,
You could write a subroutine which will do all the validations and call this subroutine for every user action for which you think the data should be validated. You could pass the old and new table to this subroutine and compare the values to see if the requirement is fulfilled and the data is valid.
Hope this helps.
Best regards,
Advait
2009 Jun 22 2:52 PM
The internal method 'set_delta_cells' is working for me. I've figured out, the best way should be to do call the method 'check_changed_data' before and after you call it.
This is what I'm doing:
1. Call 'check_changed_data' to get all fields changed by the user to the internal table.
2. Search internal table for wrong (initial in my case) fields which are not changed by the user and call 'set_delta_cells' for them.
3. Call 'check_changed_data' again, and now the fields are processed in the data changed event.
2009 Jun 22 3:10 PM
Use the method CHECK_CHANGED_DATA of the CL_GUI_ALV_GRID.
Like:
o_alv->check_changed_data(
IMPORTING
e_valid = lf_valid ).
This method calls the SAVE_DATA and in turn SAVE_DATA will trigger the DATA_CHANGED event.
Regards,
Naimesh Patel
2009 Jun 22 3:17 PM
The problem is, the changed_data event will contain only fields which are actually changed by the user - this can be emulated with the set_delta_cells method, as stated before.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |