How to get background color for individual days in SAPGUICalendar with QTP (554 Views)
Posts: 4
Registered: ‎12-17-2013
Message 1 of 5 (554 Views)

How to get background color for individual days in SAPGUICalendar with QTP

[ Edited ]


I would really appreciate someones help to work out the code to retrieve background color for the individual SAPGUICalendar days using GetROProperty. This is a client requirment we are trying to output days from the SAP GUI Calendar the days which have background color green, these are days off during the weekdays of the month.

example of code used

SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").Maximize

Dim hWndSource

hWndSource = SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").SAPGuiCalendar("Calendar").GetROProperty("backgroundcolor","28/Dec/2010")

msgbox hWndSource

The issue with above code is that it gives me a blank message were I am expecting a green color value.


The only methods I am able to use with Object. are the following:
Object.GetColor("selecteddate:=28/Dec/2010") this gives me the value 0 if I select another date with different background color I still get value 0 with this method
Object.GetColorInfo() for this method I am unable to make it work as I have to enter a color within the bracket of this method so not sure what value to input

Also I have used the following:

msgbox SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").SAPGuiCalendar("Calendar_2").GetROProperty("color","selecteddate:=28/Dec/2010")

but for this code I get a blank message no value being returned.


Also Seems like the SAPGuiCalendar object does not support this property/method currentStyle so i am unable to capture color using this method/property.

I have attached a screen shot of the individual days (green boxes) within SAPGUICalendar that I am trying to capture the color value of with QTP.

Thanks in advance!



P.S. This thread has been moved from Quality Center Support and News Forum to Unified Functional Testing (formerly QTP) News and Support Forum. - Hp Forum Moderator

Posts: 4
Registered: ‎12-17-2013
Message 2 of 5 (510 Views)

Re: How to get background color for individual days in SAPGUICalendar with QTP

Could someone please guide me on how to use the following code as at the moment the code output value 0:

hWndSource = SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").SAPGuiCalendar("Calendar_2").Object.GetColor("selecteddate:=28/Dec/2010")
msgbox hWndSource
HP Expert
Posts: 245
Registered: ‎08-06-2013
Message 3 of 5 (483 Views)

Re: How to get background color for individual days in SAPGUICalendar with QTP



I dont think this should be the value for the calendar's GetColor method: you are trying to pass a QTP/UFT test object /test object's property value (and, descriptive programming is completely wrong here) to a control's internal method..

I reviewed the SAP Gui Scripting API documentation but, unfortunately, it is also not clear there what exactly should be passed to GetColor.

Since this is an internal SAP Gui Calendar contol's method, you'd better ask in a SAP forum.

QTP/UFT itself does not provide the means for obtaining the date's color without interacting with the control's internal properties/methods.




“HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
Posts: 4
Registered: ‎12-17-2013
Message 4 of 5 (465 Views)

Re: How to get background color for individual days in SAPGUICalendar with QTP

Thanks Ana for your response.


Can anyone show me how to use the following code as I can see the method GetDateTooltip for this object with Object Spy:

SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").SAPGuiCalendar("Calendar_2").Object.GetDateTooltip("selecteddate:=28/Dec/2010")

Currently I get blank value for the above code.

GetDateTooltip method is shown in Object Spy so I can use this but the issue is how to use the method with the right values in the bracket.

Would appreciate someones expertise on this subject.

Posts: 4
Registered: ‎12-17-2013
Message 5 of 5 (447 Views)

Re: How to get background color for individual days in SAPGUICalendar with QTP

Hi All,

I have resolved this issue by using the code the following way:


Dim tr


SAPGuiSession("Session").SAPGuiWindow("Year Overview 2005 RR0").SAPGuiCalendar("Calendar").setDate "3/Jan/2005"


tr = SAPGuiSession("Session").SAPGuiWindow("Year Overview 2005 RR0").SAPGuiCalendar("Calendar").GetROProperty("StartSelection")


msgbox SAPGuiSession("Session").SAPGuiWindow("Year Overview 2005 RR0").SAPGuiCalendar("Calendar").Object.GetDateTooltip(tr)


msgbox SAPGuiSession("Session").SAPGuiWindow("Year Overview 2005 RR0").SAPGuiCalendar("Calendar").Object.GetColor(tr)


The above code gives me the coorect values for any dates selected with SAP GUI Calendar object.


Thank you to all those that have tried to help with this issue.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.