cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a user to Sap Business One 6.5 with service pack1 using DI aPI

Former Member
0 Kudos

hi,

I am was unable to add a user to Sap Business One 6.5 with service pack1 using DI aPI . following is the code.

i am getting an errocode =-5002 which is your OUSR.Password should be greater than 4 . but i have 8 character.

please help me . i am in desparate need.

Private Sub CreateUser()

Dim oUser As SAPbobsCOM.Users

Dim a As Long

Dim errMsg As String

' Set connection properties

oCompany.Server = "vishal"

oCompany.DbUserName = "sa"

oCompany.DbPassword = "pass"

oCompany.CompanyDB = "SBODemo_US"

oCompany.UserName = "manager"

oCompany.Password = "manager"

'Try to connect

lRetCode = oCompany.Connect()

If lRetCode <> 0 Then ' if the connection failed

oCompany.GetLastError(lErrCode, sErrMsg)

MsgBox("Connection Failed - " & sErrMsg, MsgBoxStyle.Exclamation, "Default Connection Failed")

End If

If oCompany.Connected Then ' if connected

Me.Text = Me.Text & " - Connected to " & oCompany.CompanyDB

End If

oUser = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUsers)

oUser.UserName = "abc1"

oUser.UserCode = "amx_ctx2"

oUser.UserPassword = "1234"

a = oUser.Add()

Call oCompany.GetLastError(a, errMsg)

If (0 <> a) Then

MsgBox("Found error:" + Str(a) + "," + errMsg)

End If

End Sub

Accepted Solutions (1)

Accepted Solutions (1)

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I have tested your code for adding a new user with version 2004A and it works fine (with the same UserName, UserCode and UserPassword as you).

Maybe you should consider using version 2004A.

Otherwise you must create a CSN message for this problem, it should work as it is. I cannot see nothing strange on it.

Regards

Trinidad.

Former Member
0 Kudos

hi,

thanx for ur reply....

i have already tried in SAP BO 2004... its working fine...

but my client requirement is SAP 6.5 with SP1 e7...

Answers (0)