12-11-2013 11:03 AM
Hi
I have a strange problem with an OO alv.
When I select one or more columns and press one of the standard alv functions like sort or summarize, the selected columns are not recognized as selected, and a popup says "Select at least one column".
The column is clearly selected as you can see:
What is wrong with my coding:
ls_layout-cwidth_opt = 'X'.
ls_layout-sel_mode = 'A'.
ls_layout-zebra = 'X'.
ls_layout-stylefname = 'CELLTAB'.
ls_layout-no_rowmark = 'X' .
CALL METHOD cr_alv_grid->set_table_for_first_display
EXPORTING
is_layout = ls_layout
is_variant = ls_variant
i_save = 'A'
CHANGING
it_outtab = ct_output[]
it_fieldcatalog = ct_fcat.
Best regards
12-11-2013 11:31 AM
Hmm
I narrowed the problem down to this code called in an event handler for event data_changed_finished
gs_stbl-row = 'X'.
gs_stbl-col = 'X'.
CALL METHOD gr_main_alv_grid->refresh_table_display
EXPORTING
is_stable = gs_stbl.
The purpose of this code was to refresh totals and sub totals of an input column after change of one of the input values.
This works, but at the same time it seems to de-select the columns before the standard functions are called.
12-11-2013 11:31 AM
Hmm
I narrowed the problem down to this code called in an event handler for event data_changed_finished
gs_stbl-row = 'X'.
gs_stbl-col = 'X'.
CALL METHOD gr_main_alv_grid->refresh_table_display
EXPORTING
is_stable = gs_stbl.
The purpose of this code was to refresh totals and sub totals of an input column after change of one of the input values.
This works, but at the same time it seems to de-select the columns before the standard functions are called.
12-11-2013 11:47 AM
Will a DELTA_REFRESH Or SOFT_REFRESH_TABLE_DISPLAY or a combination do the trick?
I believe the SOFT_REFRESH_TABLE_DISPLAY is meant to preserve the front-end settings
12-11-2013 11:59 AM
12-11-2013 12:28 PM
A workaround would be to get the selected colums using GET_SELECTED_COLUMNS and after the refresh table SET_SELECTED_COLUMNS
12-11-2013 1:27 PM
Found a solution.
For some reason event data_changed_finished is raised for every action even when no data is changed.
So my solution is to use the event data_changed to set a flag that data was changed.
Then in the data_changed_finished, I only call refresh_table_display if data was actually changed.
With this solution it is not possible to change data and use one of the SAP standard ALV functions at the same time, but that is not a major problem in my scenario.
Probably the workaround suggested by Byju is even better, but I'm happy with my own.
12-11-2013 12:01 PM
Hi Thomas,
When generating fieldcatalog try to activate the do_sum catalog property, like this:
loop ct_fcat Into wa_fieldcat.
if wa_fieldcat-fieldname = 'your_fieldname'.
wa_fieldca-do_sum = 'X'.
endif.
endloop.
Regards,
12-11-2013 12:29 PM
hi,
If we want to select the multiple columns in the alv by using ooabap
so in the class CL_GUI_ALV_GRID it is having one method SET_TABLE_FOR_FIRST_DISPLAY
it is having one importing parameter IS_LAYOUT of type lvc_s_layo type
and this structure contains one field SEL_MODE and set that field value as 'A'.
then we can select the multiple rows in alv grid
Regards,
gopi