In CRM web ui, for a lot of standard roles (none IC) there is Calendar link which enables activity/task creation and overview function which is the same as the Calendar in crmd_order transaction. The work center used is CT-CALENDR. If you switch to Day view, it will by default show time range from 8:00 to 18:00 which seems to be perfect. But in real life, the working hour might be very different in different company, and for some cases 24 hours time range might be necessary, then can we have this to be changed to suit specific requirement? Let’s come to this article for how to set up a “Make-to-Calendar” for your company.
It will include three parts:
- Change the starting and ending time for calendar day view
- Change the start day of the date picker
- Change the color of appointment display
1) Change the starting and ending time for calendar day view
Let's see firstly how the standard system behaves. F2 on the calendar page will tell the component and view name, it is CRM_CALENDAR/Calendar. If open the htm file from bsp_wd_cmpwb transaction.
You may find three tag named as
Since we are interested in how to change the start and end time within one day, we are interested in the calendar_daily tag. Let's double click on it, it will navigates to detail info for bsp element calendar_daily
And if check in detail of class CL_CHTMLB_CALENDAR_DAY, you will soon find the start and end time was handled in method IF_BSP_ELEMENT~DO_AT_BEGINNING
This actually tells that the calendar_begin and calendar_end is one of the Attributes of BSP element calendar_daily. This lead to our solution for the first point. You may change the calendar.htm with the lines as
<chtmlb:calendar_daily appointments = "<%= pt_appointments %>"
id = "caleDay"
reference_date = "//Calendar/referenceDate"
tzone = "//Calendar/timeZone"
print_mode = "<%= lv_print_mode %>"
fullPage = "<%= lv_full_page %>"
onEmptyCellClick = "<%= lv_event %>"
onTimeClick = "createAppoTime"
height = "<%= lv_height %>"
calendar_begin = "060000"
calendar_end = "230000"
2) Change the start day of the date picker
If use the similar analyzing method, we firstly find the component and view is CRM_CALENDAR/CalendarNavigator, while checking CalendarNavigator.htm in bsp_wd_cmpwb, there is a tag
It has an attribute names as firstDayOfWeek. After tracing the program, we can find it is set via a standard badi implementation
Badi definition: CALENDAR_DEFINITION
Current standard implementation class: CL_ISO_CALENDAR_DEFINITION
weekday = if_calendar_definition=>c_monday.
3) Change the color of appointment display
You may use "IE developer toolbar" for IE or "Fire bug" for fire fox to locate the element and corresponding class name.
You may try to look into thtmlb_stand.css,
the first ch-cal-mark are responsible for the dark blue little bar, and the ch-cal-daily-appt are for the light blue which is the background color for the appointment text.
A small proposal to achieve this...
Enhance the tag handler class(eg: CL_CHTMLB_CALENDAR_DAY) and add post exit to RENDER_APPOINTMENT method. in that method
IF NOT is_appointment-color IS INITIAL.
CONCATENATE '<div style="background-color:' is_appointment-color '">' rv_html '</div>' INTO rv_html.