on 11-22-2016 8:13 AM
Dear community,
I've a VBA code to SAP logon.
But I would like to process some SAP dialog window via VBA if it's possible.
Sub Logon()
Dim SapGuiApp As Object
Dim oConnection As Object
Dim session As Object
Set SapGuiApp = GetObject("SAPGUI")
Set oConnection = SapGuiApp.GetScriptingEngine
If oConnection.Children.Count > 0 Then
'MsgBox ("Connection already exist")
GoTo UseActual:
Else
Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
Set oConnection = SapGuiApp.OpenConnection("SERVER", True)
Set session = oConnection.Children(0)
GoTo Logon:
UseActual:
Set session = Nothing
Set SAPCon = oConnection.Children(0)
Set session = SAPCon.Children(0)
GoTo StartTr:
Logon:
Application.DisplayAlerts = False
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "100"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "USERNAME"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "PASS"
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
session.findById("wnd[0]").sendVKey 0
GoTo StartTr:
StartTr:
session.StartTransaction "****"
'................
Application.DisplayAlerts = True
Set session = Nothing
Set oConnection = Nothing 'SAPCon
Set SapGuiApp = Nothing
End Sub
Couldn't you help me.
In addition: I would like to process SaveAs dialog via VBA to.
Thanks in advance.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.