Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting a Value in SAPList
#1
Solved: 11 Years, 3 Months, 2 Weeks ago
Hello

I am working on automating a WebDynpro application. I am trying to select a value from the SAPList. I have tried a few different approaches but nothing seems to be working. Any input about this would be appreciated.
This SAPList is nested in a webtable and has the list options as WebElements.
Here are the things I have tried;

1.
Code:
Set sObject =  Browser("ABC").Page("ABC").Frame("ABC").SAPList("ABC").Object
     sObject.focus
     sObject.setAttribute "value", strValToSet
    
    'Make sure the right value is selected
     strSelectedItem =  oObj.getROProperty("selection")
     If Trim(strSelectedItem) = Trim(strValToSet) Then
        Reporter.ReportEvent MicPass,"Check if right value is set","The right value ["&strSelectedItem&"] was set"
    End if

- In this case, I can see that the value is set in the SAPList, but when I do the action like Continue to go to the next page for which I made the selection, it doesn't take me to the page that it soudl take me to based on my selection. It instead takes me to whatever has been selected by default in the SAPList.

2.
Code:
intU = Postion of required option in SAPList    
        For i = 1 to intPos
    set WshShell = CreateObject("WScript.Shell")
    WshShell.SendKeys"{DOWN}"
    If i = intPos Then
          WshShell.SendKeys  "{ENTER}"
                End If
         Next
- This also takes me to the page based on default selection in SAPList.

3. I have tried setting the default value to what I want to select, but that did not work either.
Code:
Browser("ABC").Page("ABC").Frame("ABC").SAPList("ABC").Object.defaultvalue="strValToSet"

Thanks
Niv
Reply
#2
Solved: 11 Years, 3 Months, 2 Weeks ago
I have never worked on a SAP based application, but, would it work if once you set the value you click on the page and then say continue?
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
#3
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi Basanth

Thanks for your response.

I found the solution. Its basically modified version of my approach 2.

Modifications -
1. I had to click the SAPList before trying to select a value
2. A wait statement was needed after keystroke DOWN to give it enough time to actually select the options.

With these changes. codeis working perfectly.

Thanks again
Niv
Reply
#4
Solved: 11 Years, 3 Months, 2 Weeks ago
Good. Whatever works is good, however I wouldnt advise using a hard wait..Instead try to syncronize the object to complete the value selection. There should be a timeout or a property. If that doesnt work use Hard Wait as the last resort.
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
#5
Solved: 11 Years, 3 Months, 2 Weeks ago
(05-10-2013, 06:43 AM)basanth27 Wrote: Good. Whatever works is good, however I wouldnt advise using a hard wait..Instead try to syncronize the object to complete the value selection. There should be a timeout or a property. If that doesnt work use Hard Wait as the last resort.

Hi,

Please find below lines of code, working perfactly. :-)

Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").FireEvent "click"
Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").Object.setAttribute "value", "Electricity"
Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").Object.focus
Browser("Browser").Page("Page").SAPFrame("SMART UI").SAPList("Equipment Number").Click
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys  "{DOWN}"
WAIT(1)
WshShell.SendKeys  "{ENTER}"
set WshShell=nothing
Reply
#6
Solved: 11 Years, 3 Months, 2 Weeks ago
Hi,
FYI, Following code, I worked for me. 

On Error Resume Next

Browser("Browser_2").Page("Page").Frame("myActionIframe").SAPList("Tracking Scenario:").Click
wait 1
pEachDropdownItem = "//*[@class='lsListbox lsListbox--popup lsLCDropShadow']//*[@class='lsListbox__value']"    
pTrackScenarioDropdown = "//*[@class='lsListbox lsListbox--popup lsLCDropShadow']"

Set Desc = Description.Create
Desc("micclass").value = "WebElement"
Desc("xpath").value = pEachDropdownItem
Set oObjs = Browser("Browser_2").Page("Page").Frame("myActionIframe").ChildObjects(Desc)

if Browser("Browser_2").Page("Page").Frame("myActionIframe").WebElement("xpath:=" & pTrackScenarioDropdown).Exist(0) Then
    For ii = 0 To oObjs.Count Step 1
        if oObjs(ii).GetROProperty("innertext") = "Manifest Query" then
            print "index:" & ii & ", value: " & oObjs(ii).GetROProperty("innertext")
            oObjs(ii).DoubleClick
        End If
    Next
end if
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Changing System Display Setting and Resolution using UFT or VB script or any code srikanthbura 0 2,654 09-07-2018, 11:21 AM
Last Post: srikanthbura
  SAPLIST is not recognised inside SAPTable mann 0 1,245 02-26-2018, 11:24 AM
Last Post: mann
  Bad Length Error on Setting values in SAPGUIEdit Ankesh 1 5,440 12-24-2014, 07:00 PM
Last Post: manishk
  Setting up QTP on Terminal Server timletap 0 2,378 09-24-2012, 06:56 PM
Last Post: timletap
  SAPLIst within a table is not working lakshjai 1 5,904 02-18-2011, 02:19 AM
Last Post: shailendra.pathak

Forum Jump:


Users browsing this thread: 2 Guest(s)