2010 May 14 7:27 AM
Hi All,
I have created an editable ALV. User can make some changes in the displayed record and press "Submit" button (custom button on application toolbar), the program should validate the data and write the file on application server if validations are successful otherwise controls stay on the same screen.
I am handling this validation and writing file part in PAI of the screen.
Problem: The program is capturing the data when user changes it for the first, but program is failing to capture the subsequent changes (user makes after the validation fails). Program processes always the first time changed data only. Please help me in getting this problem resolved.
Step1 : Program shows output.
Step2: User changes Company Code.
Step3: User clicks on Submit Button.
Step3.1: Program reads the new data and performs validation.
Step3.2: New Company code is not valid, error displayed.
Step4: User changes the company code again, presses submit button.
Goto step 3.1 -> Here program does not read the new data, rather first time changes company code is again read and validated, and program shows the same error again, which is not a desired result
Hi All,
I have created an editable ALV. User can make some changes in the displayed record and press "Submit" button (custom button on application toolbar), the program should validate the data and write the file on application server if validations are successful otherwise controls stay on the same screen.
I am handling this validation and writing file part in PAI of the screen.
Problem: The program is capturing the data when user changes it for the first, but program is failing to capture the subsequent changes (user makes after the validation fails). Program processes always the first time changed data only. Please help me in getting this problem resolved.
Step1 : Program shows output.
Step2: User changes Company Code.
Step3: User clicks on Submit Button.
Step3.1: Program reads the new data and performs validation.
Step3.2: New Company code is not valid, error displayed.
Step4: User changes the company code again, presses submit button.
Goto step 3.1 -> Here program does not read the new data, rather first time changes company code is again read and validated, and program shows the same error again, which is not a desired result
2010 May 15 12:20 AM
Hi Ashish,
you need a method HANDLE_DATA_CHANGED as handler for grid event DATA_CHANGED.
Use
LOOP AT er_data_changed->mt_mod_cells ASSIGNING <mod>.to check all changed data. In this event, add the error messages to ER_DATA_CHANGED object.
set all required handlers, i.e.
SET HANDLER:
handle_data_changed FOR ro_grid,
handle_data_changed_finished FOR ro_grid,
handle_toolbar_set FOR ro_grid,
handle_user_command FOR ro_grid,
handle_hotspot_click FOR ro_grid,
handle_f4 FOR ro_grid,
handle_f1 FOR ro_grid.
ro_grid->set_toolbar_interactive( ).
Register ENTER and MODIFIED events.
ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_enter ).
ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).Regards,
Clemens
2010 May 17 3:40 PM
In your PAI before you do the validations, you can call the method CHECK_CHANGED_DATA of your ALV Grid. This method will update the data from the ALV front end to internal Table.
On the error handling part, you can use the LOG functionality of the ALV itself by passing the Container to the I_APPLOGPARENT of the CONSTRUCTOR of the CL_GUI_ALV_GRID. Check the program BCALV_GRID_EDIT on how to handle the Log. Select the option "Error log on Screen" to see how the log is generated on the screen.
Regards,
Naimesh Patel
2010 May 17 3:51 PM
Hi All,
Thanks for your responses, but unfortunately the problem was due to other than those that have been addresses in the responses. Actually my program was reconstructing the container everytime (wrong place of clearing the container and grid reference), as a result of which it was not accepting the changes after first change.
I removed the clear statement and its working alright now.
Thanks,
Ashish
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |