Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata
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

  <chtmlb:calendar_monthly

  <chtmlb:calendar_weekly 

  <chtmlb:calendar_daily 
 
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
   <thtmlb:dateNavigator
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
method IF_CALENDAR_DEFINITION~GET_FIRST_DAY_OF_WEEK
coding is

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 

Code

IF NOT is_appointment-color IS INITIAL.
CONCATENATE '<div style="background-color:' is_appointment-color '">' rv_html '</div>' INTO rv_html.
ENDIF.


 

Then we are done at the moment. :)                    

4 Comments

  1. Former Member

    Nice lean and mean blog! Thnx.

    Do you know if it is also possible to change the colors of the appointments in the calendar? I didn't have an extensive look myself, so if you don't know, don't spend time on it yet, but if you do know, please share.

    Regards,

    Martijn.

  2. Hi Martijn,

    Sorry, I only noticed your comment after 4 months. :P
    I've taken sometime to look, since I am also interested. Not so sure whether you already get answer for this.
    This has to be changed in css file. I am updating this wiki page to include the info also.

    Hongyan

  3. Former Member

    Hi Hongyan,

    Thanks for the update.

    I also found this in the css file. I did some extensive testign and was able to hardcoded change various element colors in the calender via the css.

    But of course the business wants a dynamic color, depending on the status of the activity....... Any suggestions on that one?

    Regards,

    Martijn.

  4. Guest

    How it is possible to change the personal Calendar to an Team-Calendar. It must possible by switch the code for the Business Partner.

    Any Ideas?!?

    Regards,

    Michael Polster