#-Begin-----------------------------------------------------------------
[Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")
[Reflection.Assembly]::LoadFile("SAPFEWSELib.dll")
$SapGuiAuto = [Microsoft.VisualBasic.Interaction]::GetObject("SAPGUI")
If ($SapGuiAuto -eq $Null) {
Break
}
$Application = $SapGuiAuto.GetType().InvokeMember("GetScriptingEngine",
[System.Reflection.Bindingflags]::InvokeMethod,
$null, $SapGuiAuto, $null, $null, $null, $null)
[SAPFEWSELib.GuiApplication]$Application =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Application,
[SAPFEWSELib.GuiApplicationClass])
If ($Application -eq $Null) {
Break
}
$Connection = $Application.Children.Item(0)
[SAPFEWSELib.GuiConnectionClass]$Connection =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Connection,
[SAPFEWSELib.GuiConnectionClass])
If ($Connection -eq $Null) {
Break
}
$Session = $Connection.Children.Item(0)
[SAPFEWSELib.GuiSession]$Session =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Session,
[SAPFEWSELib.GuiSessionClass])
If ($Session -eq $Null) {
Break
}
$Mandt = $Session.FindById("wnd[0]/usr/txtRSYST-MANDT")
[SAPFEWSELib.GuiTextField]$Mandt =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Mandt,
[SAPFEWSELib.GuiTextFieldClass])
$BName = $Session.FindById("wnd[0]/usr/txtRSYST-BNAME")
[SAPFEWSELib.GuiTextField]$BName =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($BName,
[SAPFEWSELib.GuiTextFieldClass])
$Langu = $Session.FindById("wnd[0]/usr/txtRSYST-LANGU")
[SAPFEWSELib.GuiTextField]$Langu =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($Langu,
[SAPFEWSELib.GuiTextFieldClass])
$BCode = $Session.FindById("wnd[0]/usr/pwdRSYST-BCODE")
[SAPFEWSELib.GuiPasswordField]$BCode =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($BCode,
[SAPFEWSELib.GuiPasswordFieldClass])
$Mandt.Text = "001"
$BName.Text = "BCUSER"
$Langu.Text = "EN"
$Bcode.Text = "minisap"
$MainWin = $Session.FindById("wnd[0]")
[SAPFEWSELib.GuiMainWindow]$MainWin =
[System.Runtime.InteropServices.Marshal]::CreateWrapperOfType($MainWin,
[SAPFEWSELib.GuiMainWindowClass])
$MainWin.SendVKey(0)
#-End-------------------------------------------------------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |