cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Double click not working in python

Former Member
0 Likes
3,678

Hi,

I'm trying to access information by double click on a cell and it is not working. After the entering into the screen i'm unable to print any details. the automation fails.

session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").selectedNode = "0000000022"
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode("0000000022")
session.findById("wnd[0]/usr/ctxtER_STAT").text = "R"
session.findById("wnd[0]/usr/ctxtER_BP2-LOW").text = b+"*"
session.findById("wnd[0]/usr/ctxtER_RTN_D-LOW").text = today
session.findById("wnd[0]/usr/ctxtER_RTN_D-HIGH").text = today
session.findById("wnd[0]/tbar[1]/btn[8]").press()
---Code works fine until here The screen with the information reflects-- The below code does not work-            
print("In the details page")
session.findById("wnd[0]/usr/lbl[3,5]").setFocus()
print("focus")
session.findById("wnd[0]/usr/lbl[3,5]").caretPosition = 0
session.findById("wnd[0]").sendVKey(2)
print("Success")

Attached is image of the view. I'm unable to change this to a grid view.

Regards,
Renato.



View Entire Topic
Sandra_Rossi
Active Contributor

I think that you have several SAP GUI sessions, and you are running the script on the wrong session.

I've got this VBS script that you may adapt to python, to list the opened SAP GUI sessions and ask the user which session (variable sess) is to be used to run the script:

Set Wrapper = WScript.CreateObject("SapROTWr.SapROTWrapper")
Set SapGui = Wrapper.GetROTEntry("SAPGUI")
Set application = sapgui.GetScriptingEngine

if application.Children.count = 0 then
  msgbox("please start a SAP GUI session")
  wscript.quit 0
end if

prepared_question = "Choose the session:" + chr(13)
set mysessions = CreateObject("Scripting.Dictionary")
sessionNumber = -1
for connNr = 0 to application.Children.Length - 1
  set conn = application.children.ElementAt(connNr)
  for sessNr = 0 to conn.Children.Length - 1
    set sess = conn.children.ElementAt(sessNr)
    If sess.Busy = false Then
      set window = sess.ActiveWindow
      sessionNumber = sessionNumber + 1
      mysessions.add cstr(sessionNumber), cstr(connNr) & "," & cstr(sessNr)
      prepared_question = prepared_question & cstr(sessionNumber) & ": " & window.text & chr(13)
    End If
  next
next

sessionNumber = inputbox(prepared_question)
if sessionNumber = "" then
  WScript.quit 0
end if

arrSession = split(mysessions.item(sessionNumber),",")
set conn = application.children.ElementAt(cint(arrSession(0)))
set sess = conn.children.ElementAt(cint(arrSession(1)))