Micro Focus QTP (UFT) Forums
Getting child objects in SAP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Getting child objects in SAP (/Thread-Getting-child-objects-in-SAP)



Getting child objects in SAP - Shridevi.Salagare - 10-20-2011

Hi,
How to get child objects in SAP.

I want to check all the checkboxes opened in a pop-up.(Count is varying).How to handle this situation?


RE: Getting child objects in SAP - MVChowdary - 10-20-2011

Can you paste the SAP screen shot for selecting check boxes.


Can you paste SAP screen shot


RE: Getting child objects in SAP - Shridevi.Salagare - 10-20-2011

Screenshot




RE: Getting child objects in SAP - MVChowdary - 10-20-2011

Try with the following code/method.
Code:
Obj="provide required screen/object name"  
iValue="provide required checkbox value to check"
If  obj.getroproperty("enabled") AND obj.Exist Then
      If UCase(iValue) = "ON" OR UCase(iValue) = "TRUE" OR UCase(iValue) = "SET" OR UCase(iValue) = "SELECT" Then
                iValue = "ON"
                MySet = obj.set(iValue)         
            End If
            If UCase(iValue) = "OFF" OR UCase(iValue) = "FALSE" OR UCase(iValue) = "UNSELECT" OR UCase(iValue) = "" Then
                iValue = "OFF"
                MySet = obj.set(iValue)         
            End If
        End If



RE: Getting child objects in SAP - Shridevi.Salagare - 10-20-2011

Thanks MVChowdary. But, I need to set all checkboxed value as ON.

And I cant add the checkbox to Object repository as number s not fixed.
In that case can the script given by you will work?


RE: Getting child objects in SAP - Ankesh - 10-20-2011

Hi Shridevi,

U can use descriptive programming for this.

Use the FindAllByID property of the object. Usually id will have soem values like
/app/con[0]/ses[0]/wnd[1]/usr/sub:ZC_RMSERIDR1:0200/chkI_ZMFCANC-FLAG[0,0]

Usually one of the values at last (here [0,0]) will change(Usually incremented by one). Chk which values is changing so that u can use a counter for that. In my case the first value is changing(incremented by 1) and the second one remains same.

Use the below code once u identify the changes....

Code:
intStartIndex=0 'As this the start index for my object. This might chanse. Please initialize as per ur object

'Get the no of checkboxes
Set ObjCount=SAPGuiSession("Session").SAPGuiWindow("Select the serial Numbers").Object.FindAllByName("I_ZMFCANC-FLAG","GuiCheckBox")
intTotalCount=ObjCount.count

'Select all the checkboxes
For i=intStartIndex to intTotalCount-1
    Set ObjCheckBox=SAPGuiSession("Session").SAPGuiWindow("Select the serial Numbers").Object.FindById("/app/con[0]/ses[0]/wnd[1]/usr/sub:ZC_RMSERIDR1:0200/chkI_ZMFCANC-FLAG["&intStartIndex&",0]")
    ObjCheckBox.selected=True
Next

'Release the object
Set ObjCount=Nothing
Set ObjCheckBox=Nothing

Do let me know if it works.

Regards,
Ankesh


'Descriptin of the below line...

Parameters passed in FindAllByName methods are
Code:
FindAllByName(<ObjectName>,<type>).

In sap , the object name remains same for all the checkboxes(as per the scrinshot).

Code:
Set ObjCount=SAPGuiSession("Session").SAPGuiWindow("Select the serial Numbers").Object.FindAllByName("I_ZMFCANC-FLAG","GuiCheckBox")



RE: Getting child objects in SAP - Shridevi.Salagare - 10-20-2011

Hi Ankesh,
The code worked fine.
Thansk a lot for you time.


RE: Getting child objects in SAP - syoutaikon - 08-15-2013

Hi,

This problem also happened when i tried to get child objects.
My problem is:
1. the checkbox doesn't have a "name" property, it meas its name is empty, so i couldn't use "findbyname"
2. the id of the checkbox isn't permanent, so i couldn't use "findbyid"
3. meanwhile, i want to check both of the checkboxes

Following is my code:
Code:
set DDPDescription = description.Create
DDPDescription("micclass").value = "SAPGuiLabel"
DDPDescription("type").value = "GuiLabel"
DDPDescription("Text").value = "DDP"
Set childDDPObject = SAPGuiSession("PRS_QA").SAPGuiWindow("List for Condition Type").ChildObjects(DDPDescription)

Could anyone help me, plz?

Hi,

I changed my code as below:
Code:
Set DDPDescription = nothing
Set childDDPObject = SAPGuiSession("PRS_QA").SAPGuiWindow("List for Condition Type").ChildObjects(DDPDescription)
And I can get all objects in this window, however, when I tried to specify the correct one I need, I couldn't get the one.

Code:
childDDPObject(i).GetROPorperty("content") = "DDP"
Error Msg said the function was not supported.


RE: Getting child objects in SAP - Ankur - 08-15-2013

Please open a new thread for your query.