06-28-2016 1:55 PM
Hi,
I have an alv grid (class) showing some data + day01...day31 columns. I use the field catalog to turn off invalid dates, like day31 column for June.
However if I use default variant or any variant for the ALV, its settings I do in the build_field_catalog, is overwritten. Thus I cannot hide 31June (which is an invalid date).
Any suggestions how to modify fields in the variant's fieldcatalog and at what point?
Thanks,
Charlie
06-28-2016 2:13 PM
Try to find an event like after_refresh then handle it to adapt field catalog, use methods like get_frontend_catalog and then set_frontend_catalog and trigger another refresh of the display if and only if you actually changed the catalog (no infinite loop).
Regards,
Raymond
06-28-2016 2:13 PM
Try to find an event like after_refresh then handle it to adapt field catalog, use methods like get_frontend_catalog and then set_frontend_catalog and trigger another refresh of the display if and only if you actually changed the catalog (no infinite loop).
Regards,
Raymond
06-29-2016 8:47 PM
This worked, THANKS, I set up a g_first_run flag to prevent infinite loop, which is fine with me.
06-28-2016 3:27 PM
Hi,
use FM : 'NUMBER_OF_DAYS_PER_MONTH_GET'
pass month and year in it.. you will get the number of days.
then check if month have 31 days.
if days > 30.
add new field to the fieldcatalog internal table.
endif.
as you have modified the Fieldcatalog internal table at run time call the following methods
GET_FRONTEND_FIELDCATALOG, SET_FRONTEND_FIELDCATALOG methods and REFRESH_TABLE_DISPLAY.
thank you!!
06-29-2016 7:59 PM
06-29-2016 8:45 PM
CALL FUNCTION '/DSD/PR_LAST_DAY_OF_MONTHS'
Then in the field catalog I have DAY01...DAY31 fields and:
ls_fcat-no_out = 'X'.
if the day is larger than the last day of the month.
06-29-2016 8:39 PM
In such situations, I disable the option to save variants, so that users don't mess up the display and then start complaining saying, the display isn't working.
Thanks,
Juwin
06-29-2016 8:51 PM
Have you tried modifying the fieldcatolog at runtime and setting the column you wish to hide as technical?
06-29-2016 11:41 PM
Columns not to display can be marked tech = abap_true in field catalog. ALV layout variant can not override this.
Clemens