Showing results for 
Search instead for 
Did you mean: 

SAP VBScript to Login does not work all of a sudden

0 Kudos

The following script worked always to help me login into one of the selected systems. But now it throws the error 438 at the following lines. I tried everything but could not make it work. If I login manually, then all my scripts work seamlessly. Only the login script gives this error.

session.findById("wnd[0]").resizeWorkingPane 140, 37, False

Original Code


Public Function OpenSAPLogon()


Dim SysSAP

'Dim SAPApp As SAPFEWSELib.GuiApplication

'Dim SAPCon As SAPFEWSELib.GuiConnection

'Dim Session As SAPFEWSELib.GuiSession



SysSAP = Cells(ActiveCell.Row, 10)

User = Cells(ActiveCell.Row, 11)

Password = Cells(ActiveCell.Row, 12)


If Not IsObject(SAPApp) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set SAPApp = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(SAPCon) Then

'Set SAPCon = SAPApp.OpenConnection("01. AEGIS Production R/3", True)

Set SAPCon = SAPApp.Openconnection(SysSAP, True)

End If

If Not IsObject(session) Then

Set session = SAPCon.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject SAPApp, "on"

End If


session.findById("wnd[0]").resizeWorkingPane 140, 37, False

session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = User

session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = Password

session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = Cells(12, 10).Value

'Sheets("Benutzer").Visible = False

session.findById("wnd[0]").sendVKey 0

On Error Resume Next

If session.findById("wnd[1]") Then




End If

End Function

View Entire Topic
0 Kudos

Hi Amit,

Can you please specify the product you are using in another tag? That way an other expert can help you. SAP Emarsys Scripting language is used to create dynamic personalized content in Emarsys, and I'm just not sure if this is what you are looking for based on your question.

Thank you! 🙂