问题描述
我对SAP不太了解,并且我试图在Vbscript中开发脚本来对SAP中的用户进行解锁/重置,我已经设法找到了与SAP建立连接的信息,但是我不知道如果我可以使用(以及如何)使用此API“ BAPI_USER_UNLOCK”,或者还有其他方法,如何配置用于解锁/重置用户的过程。这是我详细说明的代码:
'VBS Code for SAP Login
Option Explicit
Dim WSHShell,SAPGUIPath,SID,InstanceNo,WinTitle,SapGuiAuto,application,connection,session
Dim ConUser,ConPwd
' Main
ConUser = InputBox("Please enter the SAP connection user ID","UserSAP")
ConPwd = InputBox("Please enter the Password of the SAP connection user","PwdUserSAP")
Set WSHShell = WScript.CreateObject("WScript.Shell")
If IsObject(WSHShell) Then
' Set the path to the SAP GUI directory
SAPGUIPath = "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\"
' Set the SAP system ID
SID = "eaiserver.domain.com"
' Set the instance number of the SAP system
InstanceNo = "38"
' Starts the SAP GUI
WSHShell.Exec SAPGUIPath & "SAPgui.exe " & SID & " " & _
InstanceNo
' Set the title of the SAP GUI window here
WinTitle = "SAP"
While Not WSHShell.AppActivate(WinTitle)
WScript.Sleep 250
Wend
Set WSHShell = nothing
End If
WScript.Sleep(5000) ' <--- Wait 5 seconds for SAP GUI to load
If Not IsObject(application) Then
Set SapGuiAuto = Getobject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session,"on"
WScript.ConnectObject application,"on"
End If
session.findById("wnd[0]").resizeWorkingPane 164,40,false
session.findById("wnd[0]/usr/txtRSYST-BNAME").text = ConUser
session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = ConPwd
session.findById("wnd[0]/usr/pwdRSYST-BCODE").setFocus
session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 14
session.findById("wnd[0]").sendVKey 0
' Shutdown the connection
Set Session = nothing
Connection.CloseSession( "ses[0]")
Set Connection = nothing
' Wait a bit for the connection to be closed completely
Wscript.Sleep 1000
Set Application = nothing
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)