on 11-23-2012 10:54 AM
Hello ,
I am using the below coding
Sub sVBScriptSAP()
On Error Resume Next
If Not IsObject(SAP_applic) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAP_applic = SapGuiAuto.GetScriptingEngine
End If
er = Err.Number
On Error GoTo 0
If er <> 0 Then
er = 0
On Error Resume Next
Call Shell("C:\Program Files\SAP6\SAPgui\saplogon.exe", vbMinimizedFocus)
Call Shell("C:\Program Files\SAP640\SapGui\saplogon.exe", vbMinimizedFocus)
On Error GoTo 0
er = 0
On Error Resume Next
If Not IsObject(SAP_applic) Then
Set SapGuiAuto = GetObject("SAPGUI") 'Setting
Set SAP_applic = SapGuiAuto.GetScriptingEngine
End If
er = Err.Number
On Error GoTo 0
If er <> 0 Then
tmp = MsgBox("SAP Logon not installed on your system" & vbCrLf & _
"Please install it using eSupport!", vbInformation)
End
End If
End If
Set Connection = SAP_applic.openconnection(SAPBox)
Set Session = Connection.Children(0)
End Sub
When i run the macro , i get error as "error description not available" can u tell me why this error is coming . where i am going wrong .
thanks a lot once again,
Monalisa
Hi Monalisa,
You can try the following:
Sub sVBScriptSAP()
On Error Resume Next
If Not IsObject(SAP_applic) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAP_applic = SapGuiAuto.GetScriptingEngine
End If
er = Err.Number
On Error GoTo 0
If er <> 0 Then
er = 0
On Error Resume Next
Call Shell("C:\Program Files\SAP6\SAPgui\saplogon.exe", vbMinimizedFocus)
Call Shell("C:\Program Files\SAP640\SapGui\saplogon.exe", vbMinimizedFocus)
On Error GoTo 0
waitTill = Now() + TimeValue("00:00:01")
While Now() < waitTill
DoEvents
Wend
er = 0
On Error Resume Next
If Not IsObject(SAP_applic) Then
Set SapGuiAuto = GetObject("SAPGUI") 'Setting
Set SAP_applic = SapGuiAuto.GetScriptingEngine
End If
er = Err.Number
On Error GoTo 0
If er <> 0 Then
tmp = MsgBox("SAP Logon not installed on your system" & vbCrLf & _
"Please install it using eSupport!", vbInformation)
End
End If
End If
Set Connection = SAP_applic.openconnection("mySAPSystemName")
Set session = Connection.Children(0)
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "myMandant"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "myName"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "myPW"
Session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
session.findById("wnd[0]").sendVKey 0
End Sub
Regards,
ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mySAPSystemName : It is the name of the SAP system from SAP Logon PAD.
In the current system, you can check it as follows::
If Not IsObject(SAP_applic) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAP_applic = SapGuiAuto.GetScriptingEngine
End If
set Connection = SAP_applic.children(0)
msgbox connection.description
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.