Created
February 8, 2023 04:05
-
-
Save khanhkhuu/39d226121aa1872397bdb2d73f594e93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim SapGuiAuto | |
Dim objGui As GuiApplication | |
Dim objConn As GuiConnection | |
Dim session As GuiSession | |
Public Sub DoSomethingWithSAP() | |
' Create SAP Instance | |
ConnectionString = "Asia: (R/3 Test) CAI" | |
Set SapGuiAuto = CreateObject("Sapgui.ScriptingCtrl.1") | |
' Show SAP Instance or not | |
HideGui = True | |
If (HideGui) Then ConnectionString = ConnectionString & "/INPLACE" | |
Set objConn = SapGuiAuto.OpenConnection(ConnectionString, True) | |
Set session = objConn.Children(0) | |
Dim win As GuiFrameWindow | |
Set win = session.ActiveWindow | |
If win.Text = "License Information for Multiple Logon" Then | |
session.FindById("wnd[1]/usr/radMULTI_LOGON_OPT2").Select | |
session.FindById("wnd[1]/tbar[0]/btn[0]").Press | |
End If | |
Set win = session.ActiveWindow | |
If win.Text = "Information" Then | |
session.FindById("wnd[1]/tbar[0]/btn[0]").Press | |
End If | |
' Do something with Session here | |
' End | |
' Close SAP | |
Set session = Nothing | |
Set objConn = Nothing | |
Set SapGuiAuto = Nothing | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment