Skip to Content
avatar image
Former Member

VB script to load entries into SAP

Hello Experts,

I am looking for some help to automate the process to change default passwords and set same password for a bunch of test user Ids created in SAP (ECC 6.0) using SU01. First I have created test user Ids via SU01 and assigned them a default password while creation. Now I want to share these user ids with the testers but with same passwords saved for all of the user Ids. After researching this forum and all over the internet I came up with the following code below. I created the User ids using a different script and this one below is for logging in as that Test user Id and changing the password. The logic behind this script is as follows: I have stored all user ids in an excel. This script will open a SAP session login with 1st user id and default password-->enter a new password (same for all)--> save and exit session. This is done till all rows in the excel are done. But the problem I am facing is the script stops after 1st entry and exits. Can you kindly provide your expert deduction and help me. Many thanks in advance.

strFilePath = "\\Filepath\LoadUsers.xlsx"
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(strFilePath)
Dim intRow
intRow = 1

Do Until objExcel.Cells(intRow,1).Value = ""

If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If

session.findById("wnd[0]/usr/txtRSYST-MANDT").text = "100"
session.findById("wnd[0]").resizeWorkingPane 197,33,false
session.findById("wnd[0]/usr/txtRSYST-BNAME").text = objExcel.Cells(intRow, 1)
session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "Initialpassword1"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 15
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[1]/usr/pwdRSYST-NCODE").text = "Newpassword1"
session.findById("wnd[1]/usr/pwdRSYST-NCOD2").text = "Newpassword1"
session.findById("wnd[1]/usr/pwdRSYST-NCOD2").caretPosition = 8
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/okcd").text = "/nex"
session.findById("wnd[0]").sendVKey 0

intRow = intRow + 1


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

0 Answers