10-19-2004 7:55 AM
Hi All,
My grid has a display/edit mode. At the end of the "on_save"-event-handler I refresh the updated date with refresh_table_display, but the totals aren't updated...
The call is without use of any parameters, even i_soft_refresh = space doesn't work.
Any help would be appriciated.
Regards from a sunny Amsterdam,
B E R T
10-19-2004 8:55 AM
Can you post the code BERT ?
More than 50 lines would be a little difficult to go through.
Suggest you, to post the class definition and implementation. Event implementation and how you have called the set_table_for_first_display or refresh_table_display ?
Regards,
Subramanian V.
10-19-2004 10:32 AM
Here we go.
It all starts with the following line in PAI module (grid is instance of cl_gui_alv_grid).
CASE sy-ucomm.
WHEN 'SAVE'.
CALL METHOD grid->check_changed_data
IMPORTING e_valid = rc
CHANGING c_refresh = s.
This triggers the data_changed event. The "on_data_changed" event handler for this event loops at the er_data_changed->mt_good_cells-table and saves data using a function module.
LOOP AT er_data_changed->mt_good_cells INTO good_cell.
READ TABLE grid_data_tab INTO grid_line INDEX good_cell-row_id.
CLEAR plan_value.
MOVE-CORRESPONDING grid_line TO plan_value.
plan_value-wkg000 = good_cell-value.
APPEND plan_value TO plan_values.
AT END OF fieldname.
CONCATENATE good_cell-fieldname(1)
good_cell-fieldname+4 INTO p_versn.
CALL FUNCTION 'ZJ_SAVE_PROJECT_PLANNING'
EXPORTING
kokrs = grid_line-vkokr
gjahr = sy-datum(4)
versn = p_versn
TABLES
planned_values = plan_values[].
REFRESH plan_values[].
ENDAT.
ENDLOOP.
When done the modus is swapped from edit to display with
CALL METHOD me->swap_edit_mode.
This method is sets the appropriate fieldcat and layout to and setst the ready_for_input flag.
CALL METHOD:
grid->set_frontend_fieldcatalog
EXPORTING it_fieldcatalog = disp_mode-fcat,
grid->set_frontend_layout
EXPORTING is_layout = disp_mode-layo,
grid->set_ready_for_input EXPORTING i_ready_for_input = 0.
After which the grid is refreshed
CALL METHOD grid->refresh_table_display
EXPORTING i_soft_refresh = space.
All works fine except for the totals not being updated.
10-19-2004 10:58 AM
Just went through your code and did not find method set_table_for_first_display. It seems you have used a work around.
Instead of using:
CALL METHOD:
grid->set_frontend_fieldcatalog
EXPORTING it_fieldcatalog = disp_mode-fcat,
grid->set_frontend_layout
EXPORTING is_layout = disp_mode-layo,
grid->set_ready_for_input EXPORTING i_ready_for_input = 0.
you can use method set_table_for_first_display.
call method grid1->set_table_for_first_display
exporting i_structure_name = 'SFLIGHT'
is_print = gs_print
is_layout = gs_layout
changing it_outtab = gt_sflight.
Instead of the i_structure_name, there is another field called it_fieldcatalog where you can pass your own field catalog. As far as I know, there is no need for a refresh_table_display even.
Let us know how this turns out and if you could solve the problem.
Regards,
Subramanian V.
10-19-2004 11:29 AM
Indeed I've sent only the refresh-part starting from PAI.
Before that the grid is displayed using the following
CALL METHOD:
me->create_layouts CHANGING layout_display = disp_mode-layo
layout_edit = edit_mode-layo,
me->create_fieldcats CHANGING fieldcat_display = disp_mode-fcat
fieldcat_edit = edit_mode-fcat,
me->create_sort CHANGING sort = sort.
CALL METHOD:
grid->set_ready_for_input EXPORTING i_ready_for_input = 0,
grid->set_table_for_first_display
EXPORTING
i_default = 'X'
is_layout = disp_mode-layo
i_save = 'A'
CHANGING
it_sort = sort
it_outtab = grid_data
it_fieldcatalog = disp_mode-fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
CASE sy-subrc.
WHEN 0.
me->grid_on_screen = 'X'.
MESSAGE s000(e4) WITH n text-s01.
WHEN OTHERS.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDCASE.
Cheers, B E R T
PS. Couldn't get indenting to work in this editor
10-19-2004 11:44 AM
Does it work, if you click the refresh button on the toolbar ?
Regards,
Subramanian V.
10-19-2004 12:48 PM
Don't have "refresh" in the toolbar (using lvc not slis).
greetz, B E R T
10-19-2004 1:09 PM
Request you to check this program <b>BCALV_GRID_EDIT</b>. In this case, after changing the value, the subtotal does not change, but on <b>pressing the refresh button</b> it does.
As well as, you can put a <b>break-point in PBO</b>, and check whether the <b>control goes to PBO</b>, after <b>pressing the</b> <b>save button</b>.
Regards,
Subramanian V.
10-19-2004 7:57 PM
Hi
"TOTALS_BEF" option is used for displaying totals calculated as the first rows in the grid control.
It seems you require a deep debugging.
*--Serdar
10-20-2004 11:12 AM
Hi All,
I've done what every programmer does when things aren't going his/her way: Have a good night sleep
I've worked around the problem by retrieving the data once more. The loss of performance is surmountable.
Thanks for thinking along so far. I'm closing the call for now, but I'll welcome any ideas in solving this problem.
Cheers,
B E R T
10-19-2004 12:53 PM
Hallo Bert,
Set these properties:
1.) lvc_s_layo-totals_bef = 'X'.
2.) lvc_s_fcat-do_sum = 'X'.
Afterwards every ..hnd->refresh_table_display the
summing's will be updated.
Hope i could help you
BR
Michael