I am starting SAP GUI through subprocess
. However, I need it to start in administrator mode. What do I need to change in the code?
path = r"C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe"
subprocess.Popen(path)
time.sleep(3)
SapGuiAuto = win32com.client.GetObject("SAPGUI")
if not type(SapGuiAuto) == win32com.client.CDispatch:
print('return')
application = SapGuiAuto.GetScriptingEngine
connection = application.OpenConnection("ECC QAS", True)
time.sleep(3)
session = connection.Children(0)
try:
session.findById("wnd[0]/usr/txtRSYST-MANDT").text = "300"
session.findById("wnd[0]/usr/txtRSYST-BNAME").text = 'USER' #USUARIO
session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = 'PASSWORD' #SENHA
session.findById("wnd[0]/usr/txtRSYST-LANGU").text = 'PT' #IDIOMA
session.findById("wnd[0]").sendVKey(0) #ENTER
except:
print(sys.exc_info()[0])