Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting child objects in SAP
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
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?
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Can you paste the SAP screen shot for selecting check boxes.


Can you paste SAP screen shot
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Screenshot



Attached Files Image(s)
   
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
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
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
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?
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
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")
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi Ankesh,
The code worked fine.
Thansk a lot for you time.
#8
Solved: 11 Years, 4 Months, 3 Weeks ago
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.


Attached Files Image(s)
   
#9
Solved: 11 Years, 4 Months, 3 Weeks ago
Please open a new thread for your query.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course


Possibly Related Threads…
Thread Author Replies Views Last Post
  SwfTreeview - Color validation for child item YogeshCallappa 0 2,314 11-10-2016, 04:55 PM
Last Post: YogeshCallappa
  Driver Script to control child scripts sumanhyd 1 3,222 07-26-2016, 07:06 PM
Last Post: Ankesh
  UFT 12.50 unable to recognize child objects from a Dialog Class in Firefox jesusisaac 1 3,860 08-20-2015, 11:39 PM
Last Post: ADITI1992
  Child object shwetakondekar 0 2,157 07-01-2015, 03:28 PM
Last Post: shwetakondekar
  How to write a script for fly out menus (Parent - Child - Sub Child) rajkumarsm 3 4,774 09-02-2014, 10:01 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)