Can we display holidays in F4 help for date?
The answer is yes.
We can display/highlight public holidays in F4 help for date based on the country calendar.
This can be done by assigning factory calendar Id to the function module “F4_DATE”.
Before assigning the factory calendar id, the F4 help for date is as below.
Here is the sample code –
PARAMETERS p_date TYPE workflds-gkday. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_date. CALL FUNCTION 'F4_DATE' EXPORTING date_for_first_month = sy-datum factory_calendar_id = 'IN' " 'IN' for India IMPORTING select_date = p_date EXCEPTIONS calendar_buffer_not_loadable = 1 date_after_range = 2 date_before_range = 3 date_invalid = 4 factory_calendar_not_found = 5 holiday_calendar_not_found = 6 parameter_conflict = 7 OTHERS = 8. IF sy-subrc <> 0. * Implement suitable error handling here ENDIF.
Execute the program and press F4.
In this way, we can highlight the holidays based on the country in the date input help.
Note: We can see all the factory calendar ids at the transaction SCAL.