Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get background color for individual days in SAPGUICalendar with QTP
#1
Solved: 10 Years, 10 Months ago
Hi,

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

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

Dim hWndSource

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

msgbox hWndSource

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

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!


Attached Files
.zip   Trying to identify Individual Days (Green Boxes) with SAPGUICalendar using QTP.zip (Size: 25.69 KB / Downloads: 155)
Reply
#2
Solved: 10 Years, 10 Months ago
Is their no one out there that can help it is very urgent please!!!!!
Reply
#3
Solved: 10 Years, 10 Months ago
Hi,

Not sure but instead of GetRoProperty try to use DOM.

Regards,
Sankalp
Reply
#4
Solved: 10 Years, 10 Months ago
Hi Sankalp,

Thank you for your response.

I had tried the following code:

Code:
hWndSource = SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").SAPGuiCalendar("Calendar_2").Object.GetColor("selecteddate:=28/Dec/2010")
msgbox hWndSource

But I get the following output 0.

I then tried to use another date "selecteddate:=30/Dec/2010" which had a different background color in the date cell but again get the same output which is the value 0.

I am therefore not able to capture the difference in color between the 2 date cells for SAPGUICalendar object.

Would really appreciate some help with resolving this problem that I am facing from QTP experts out there in the field.
Reply
#5
Solved: 10 Years, 10 Months ago
Hi,

I had never worked with SAP object but u can use the below as a reference;
Code:
Dim objWeb,objAll
Set objWeb=Browser().page().webelement()
Set objAll=objWeb.Object
backColor=objAll.currentStyle.backgroundColor
msgBox(backColor)

Hope this help u.

Regards,
Sankalp
Reply
#6
Solved: 10 Years, 10 Months ago
Hi Sankalp,

Again thank you for your recommendation.

using your code I get the following error message "Object doesn't support this property or method: 'currentStyle'."

Seems like the SAPGuiCalendar object does not support this property/method currentStyle.

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:
Code:
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.

Maybe I am missing something very simple, really hope someone can shed somelight into this.
Reply
#7
Solved: 10 Years, 10 Months ago
There is no "backgroundcolor" property for the SAPGuiCalendar object.
You can check in OR or Object Spy the available properties for this object.

You could however acces the object's internal properties and methods with the help of the .Object property and use them for this purpose.
For example, for SAPGuiCalendar.Object. there is a GetColor function.
But more information about this or other internal properties and methods you can find in relevant SAP GUi API (scripting) documentation.

For more information about .Object property, please check here: http://support.openview.hp.com/selfsolve...t/KM177318

Thank you,
Veeru
Reply
#8
Solved: 10 Years, 10 Months ago
Hi Veeru,

Thank you for your response!

I have tried to use the internal property and method Object.Getcolor example below of code
Code:
hWndSource = SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").SAPGuiCalendar("Calendar_2").Object.GetColor("selecteddate:=28/Dec/2010")
msgbox hWndSource

but I get the value 0 as the output and if I use another date which has a different color in date cel then the above date I get the same value 0.
Please advice if I am using the Object.GetColor correctly seems at the moment it is not.

I am unable to open the KM article from the link you had provided i get the following message "You are not authorized to view this document".

I think I am missing something in my code to extract the background color of the SAP GUI Calendar date cell, hoping you can help with this!

Thanks in advance!
Reply
#9
Solved: 10 Years, 10 Months ago
Could someone please guide me on how to use the following code as at the moment the code output value 0:

Code:
hWndSource = SAPGuiSession("Session").SAPGuiWindow("Year Overview 2010").SAPGuiCalendar("Calendar_2").Object.GetColor("selecteddate:=28/Dec/2010")
msgbox hWndSource
Reply
#10
Solved: 10 Years, 10 Months ago
Unfortunately, I have not worked on SAP applications. I Would be of least help to you, However, I am willing to share my General Knowledge with you if that probably may lead you to the right answer.

It is clear that GetColor is not the correct method to be used here or rather it is not returning back the value it should. You should look for a different method or option here. Here is what I would do,

1. Drill down the spied color cell object and check if you have Items.Cells or some hirearchy as below. Look for BackgroundColor or Color or BGcolor which may have a HexaDecimal value for the Green Color.

2. It is most likely that the Cell could be a object here which holds the color property. Try to look for the color property in that direction.

3. If you have hit the wall without any option and if you have the luxury of a developer sitting beside you who has developed it or rather who has access to the codebase, then talk to him and see what is the property being set for that object. He should be able to exactly show you how the color value is being set and to which object it corresponds. You may already have read this but if you havent this may be of some help. (http://help.sap.com/saphelp_46c/helpdata...ameset.htm)

Finally, dont lose hope. Try to google around your problem, post your query on multiple sites and keep looking. Every problem has a solution and without a solution there does not exist a problem Smile
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
Jump to the post that solved this thread.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with Text color recognition Treirk 0 1,101 06-17-2019, 12:19 PM
Last Post: Treirk
  Getting background color of an object on mouse over Surya 2 3,886 06-27-2018, 08:51 PM
Last Post: vensas3181
  How can we get the Windows application Text box background color Using UFT 11.53 Kuppampattu 3 6,014 06-06-2017, 11:12 AM
Last Post: workrohit08
  SwfTreeview - Color validation for child item YogeshCallappa 0 2,290 11-10-2016, 04:55 PM
Last Post: YogeshCallappa
  how to get background color of a WinButton javierchen 1 3,048 03-17-2015, 10:59 PM
Last Post: babu123

Forum Jump:


Users browsing this thread: 1 Guest(s)