cancel
Showing results for 
Search instead for 
Did you mean: 

How can i check sap user and password in my add on application?

Former Member
0 Kudos

Hi all,

I need to create one add on application for my customer.In my app,I have to create log in form like the picture below

When they click Log In, I want to check this user name and password are correct/exist in table OUSR or not. If it has, it can see other form.

So to check the user and password in sap, Anyone know how to do?

Note: I want to execute store procedure in sql server to check user in OUSR table but because of the password is encrypt i don't know how to decrypt.

Thanks

TONY

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Tony,

Use this


oCompany.Server = "Server";

oCompany.LicenseServer = "LicServer:30000";

oCompany.CompanyDB = "Company";

oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2012;

SAPbobsCOM.AuthenticateUserResultsEnum oResult  =  oCompany.AuthenticateUser(bstrUserName, bstrPassword);

Regards
Edy

Answers (2)

Answers (2)

pvsbprasad
Active Contributor
0 Kudos

Hi,

  1. oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008 
  2.             oCompany.Server = "SAPSERVER" 
  3.             oCompany.LicenseServer = "SAPSERVER:30000" 
  4.             oCompany.CompanyDB = "Promethium_Test" 
  5.             oCompany.UserName = "it" 
  6.             oCompany.Password = "p@ssw0rd"  
  7.             oCompany.Connect 

regards,

Prasad

Former Member
0 Kudos

Hi Soeun,

If you stay in this way, the only solution is to logon on the DI-API.

But why do you have a need to logon specifically your addon?

Regards,

Eric

Former Member
0 Kudos

Hi All,

By looking at something fully different, it reminds me that a different option exists: if your addon is already connected to the UI-DI, you can use the Company.AuthenticateUser method.

Regards,

Eric

edy_simon
Active Contributor
0 Kudos

Hi Eric,

The AuthenticateUser method can be called without having to be connected first.

Just supply the DBServerType, ServerName, LicenseServer and the CompanyDB should be enough to call this method.

Regards

Edy

Former Member
0 Kudos

Hi Edy,

I was surprised bu your answer, since the method is taking only as parameters a username and a password.

After checking, even by providing the needed informations to the Company object and not connecting, it doesn't work: the method to be successful, needs a Company object connected with a user which has super-user's right.

Regards,

Eric

edy_simon
Active Contributor
0 Kudos

Hi Eric,

I have just retested under 882PL8

It is working as it is supposed to.

Not sure why it is not working for you.

Regards

Edy

Former Member
0 Kudos

Hi Edy,

I have found my error in my code: your suggestion is working.

Regards,

Eric