cancel
Showing results for 
Search instead for 
Did you mean: 

How to define custom calendar with colors

Former Member
0 Kudos

Hi Experts,

Generally for a date field if we choose F4, by default Standard calendar will be displayed in CRM WEB UI. My requirement is to display calendar with color coding.Certain dates in the month should be displayed as green, where as some other in another color. Please let me know your inputs how to implement these changes?

Example

1) from 3 to 9, it should be in green

2) From 10 to 16, it should be in orange

3) From 17 to 23, it should be in green.

2

SundayMondayTuesdayWednesdayThursdayFridaySaturday
1
3456789
10111213141516
17181920212223
24252627282930

Thanks & Regards,

S.Gangireddy

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member210661
Active Contributor
0 Kudos

Hi Gangireddy,

there is no standard customizing to change color for your requirement as said Bruce Li,

what you have to do is go to that class cl_chtmlb_calendar_month method render_calendar_body

there is a statement for background color.

IF ME->REFERENCE_DATE+4(2) <> IV_DATE+4(2) AND

      ME->PRINT_MODE EQ 'FALSE'.

*    LV_BACKGROUND = '#F9F9F9'.

*    Commented by STEFANOVST, causing issue in IE7

*    @todo: Maybe in general, colors should be defined in CSS

   ELSE.

     IF ME->PRINT_MODE EQ 'FALSE'.

       LV_BACKGROUND  = cl_thtmlb_util=>escape_xss_xml_html( ME->CALENDARBACKGROUND ).

     ELSE.

       LV_BACKGROUND = 'FFFFFF'.

     ENDIF.

   ENDIF.


just change the color code in run time you will get colors..


i have checked in my system this will work like this.


what you have to do is create implicit enhancement for that method and try to implement code according to your requirement.

try to explore this link might be helpful to you. these is related to factory calendar based on holidays she has populated color but in your Scenario you have to populate color based on ur condition.

Regards,

Srinivas.

Former Member
0 Kudos

Hi Srinivas,

Thank you for your inputs.

I want to implement for the date field F4 help not in the calendar work center.

Below is the screen shot for reference.

Thanks & Regards,

S.Gangireddy

bruce_li
Contributor
0 Kudos

Hi S.Gangireddy,

For the month view of canlendar, you can debug at following method. There is no standard customzing to change color. So you need to change the coding and css files correspondingly.

CL_CHTMLB_CALENDAR_MONTH
Method     RENDER_CELL_BODY

CL_CHTMLB_CALENDAR_MONTH
METHOD  RENDER_CALENDAR_BODY

Best Regards,

Bruce

Former Member
0 Kudos

Hi Bruce Li,

Thank you for your inputs.

Kept break points in the two methods(RENDER_CELL_BODY, RENDER_CALENDAR_BODY). Even though i select the F4 help for date field, these methods are not being triggered.

Thanks & Regards,

S.Gangireddy