2009 Jun 30 6:35 PM
Hi All,
I have a question with OO ALV. I have an Editable ALV output which contains around 10 fields. In the output the User can Edit/Insert/Delete the Records, and on the application tool bar I have a button (CHANGE)by which the user can swtich between the change and display mode of ALV.
Once the ALV list is displayed, when the user click on change the output is open for Editing. Lets say the user deletes the record, and again clicks on the change(which should take to display) by giving the message "Changes made will be lost" and the old data should get displayed.
The logic i followed is,
1. displayed the ALV.
CALL METHOD gr_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = gt_exclude
is_layout = gs_layout
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab[].
2. when I click on the change button, the ALV is set for Edit using
CALL METHOD gr_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
lets say, now the record in the output is deleted, and I clicked on Change again, which should take me to display with the old data.
can you help me in displaying the old data.
Hi All,
I have a question with OO ALV. I have an Editable ALV output which contains around 10 fields. In the output the User can Edit/Insert/Delete the Records, and on the application tool bar I have a button (CHANGE)by which the user can swtich between the change and display mode of ALV.
Once the ALV list is displayed, when the user click on change the output is open for Editing. Lets say the user deletes the record, and again clicks on the change(which should take to display) by giving the message "Changes made will be lost" and the old data should get displayed.
The logic i followed is,
1. displayed the ALV.
CALL METHOD gr_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = gt_exclude
is_layout = gs_layout
CHANGING
it_fieldcatalog = pt_fieldcat
it_outtab = pt_outtab[].
2. when I click on the change button, the ALV is set for Edit using
CALL METHOD gr_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
lets say, now the record in the output is deleted, and I clicked on Change again, which should take me to display with the old data.
can you help me in displaying the old data.
2009 Jun 30 7:00 PM
You copy your internal table into one temporary table and use it when you want to refresh data back to original ALV.
CALL METHOD gr_grid->set_table_for_first_display
....
T_DATA_BACKUP[] = T_OUTTAB[].
When you want to refresh it back, you set the T_OUTTAB from the T_DATA_BACKUP and call the refresh method for ALV.
Like:
T_OUTTAB[] = T_DATA_BACKUP[].
o_alv->refresh_table_display( ).
Regards,
Naimesh Patel
2009 Jul 01 9:15 AM
HI Naimesh,
Yes, I did the same..in my code, if i implement I am getting the below problem.
After the ALV display, I copied the data t_outtab in local table like t_outab_temp.
I got the ALV output first time, I am into Edit mode using the change button on the tool bar. Deleted one Record, and again clicked on Change button( it will take to display by giving the message), I refreshed the ALV as you said. the data is fine.
if I perform the same operation again, I am not getting the delete record back, how ever the internal table has the correct no. of records, but the output is less.
Thanks for you response.
2009 Jul 01 2:41 PM
It works good for me.
I copied the program BCALV_EDIT_01 to Z program and add the required logic. Backup of the table after the ALV display
gt_backup = gt_outtab.
Refreshing the ALV table display in the perform SWITCH_EDIT_MODE
*§3.Use IS_READY_FOR_INPUT to fetch current substate of editable cells.
IF g_grid->is_ready_for_input( ) EQ 0.
*§4.Use SET_READY_FOR_INPUT to switch between the substates.
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 1.
ELSE.
*------ ADD Begin
message I398(00) with 'Data not saved.!'.
gt_outtab = gt_backup.
g_grid->refresh_table_display( ).
*------- ADD end
CALL METHOD g_grid->set_ready_for_input
EXPORTING i_ready_for_input = 0.
ENDIF.
Regards,
Naimesh Patel