on 2016 Jul 07 11:00 AM
Hi experts,
I am trying to create BP master in all sub-level companies while it got created in Main Company. I using DI-API to connect to another company other than the connected SAP B1 company. ie., I am login to Main company. If BP is created , then the same BP has to be created in another three companies.
Sample coding Tried:
ocompany = New SAPbobsCOM.Company
ocompany.Server = server '
ocompany.CompanyDB = SAPDB '"PMITest"
ocompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008
ocompany.DbUserName = db_uid '"sa"
ocompany.DbPassword = db_pwd
ocompany.UserName = SAPUser '"manager"
ocompany.Password = SAPpwd '"1234"
ocompany.language = SAPbobsCOM.BoSuppLangs.ln_English
ocompany.UseTrusted = False
ocompany.LicenseServer = Licsrvr '
But I am getting the error like Unable to access SBO-Common .
Any suggestion is highly appreciated.
Thanks & Regards,
Parvatha Solai.N
Hi.
Connecting in SBO newer than 88 only requires this information :
ocompany.Server = "servername"
ocompany.CompanyDB = "PMITest"
ocompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008
ocompany.UserName = "manager"
ocompany.Password = "1234"
ocompany.LicenseServer = Licsrvr:30000 'Optional if you have the DI API\conf folder set up correctly
Note that the port number need to be in the licenseserver.
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Edy,
Thanks for your reply.I tried as you said in a seperate sub method namely company1_connection which is called in main method as below:
Sub Main(ByVal args() As String)
Try
Dim oApp As Application
If (args.Length < 1) Then
oApp = New Application
Else
oApp = New Application(args(0))
End If
company1_connection()
Dim MyMenu As Menu
MyMenu = New Menu()
MyMenu.AddMenuItems()
AddHandler Application.SBO_Application.AppEvent, AddressOf SBO_Application_AppEvent
oApp.Run()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
But, I am getting error like -10, error description as "- The specified resource name cannot be found in the image file." at the line ocompany.connect().
Any suggestions?
Thanks & Regards,
Parvatha Solai.N
Hi Edy,
The company1_connect is as below:
Sub company1_connection()
Try
Dim lRetCode As Integer
Dim lErrCode As Integer
Dim sErrMsg As String
ocompany1 = New SAPbobsCOM.Company
Try
ocompany1.Server = server
ocompany1.CompanyDB = companydb
ocompany1.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012
ocompany1.UserName = sapuserid
ocompany1.Password = sappwd
ocompany1.LicenseServer = Licsrvr 'LicenseServer includes port:30000
lRetCode = ocompany1.Connect
If lRetCode <> 0 Then
Application.SBO_Application.SetStatusBarMessage("Could not connect to SAP.Please check Login Credentials")
Application.SBO_Application.SetStatusBarMessage(ocompany1.GetLastErrorCode) Application.SBO_Application.SetStatusBarMessage(ocompany1.GetLastErrorDescription())
Else
Application.SBO_Application.SetStatusBarMessage("Connected ")
End If
Catch ex As Exception
Finally
GC.Collect()
GC.WaitForPendingFinalizers()
End Try
Catch ex As Exception
End Try
End Sub
Thanks & Reply,
Parvatha Solai.N
Hi ParvathaSolai,
you problem may occur due to the value that you are placing tother property Server.
You have to check different values of the same thing.
Eg For my local installation i can use these values
127.0.0.1
(local)
(localhost)
mycomputername
All these values, represent the same thing but with different ways
Kind Regards,
Evangelos D. Plagianos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ParvathaSolai,
you can use the code below for "intercompany" transactions
//// Set the mandatory properties for the connection to the database.
//// here I bring only 2 of the 5 mandatory fields.
//// To use a remote Db Server enter his name instead of the string "(local)"
//// This string is used to work on a DB installed on your local machine
//// the other mandatory fields are CompanyDB, UserName and Password
//// I am setting those fields in the ChooseCompany Form
//i' using an SQL Command to load connection data
SAPbobsCOM.Recordset oRS = ........
this.CompanyConnection.Server = oRS.Fields.Item("U_Server").Value.ToString();
this.CompanyConnection.language = BoSuppLangs.ln_English;
//// Use Windows authentication for database server.
//// True for NT server authentication,
//// False for database server authentication.
//this.CompanyConnection.UseTrusted = true;
this.CompanyConnection.UseTrusted = false;
this.CompanyConnection.DbUserName = "sa";
this.CompanyConnection.DbPassword = oRS.Fields.Item("U_DBPassWord").Value.ToString();
this.CompanyConnection.CompanyDB = oRS.Fields.Item("U_CompanyDB").Value.ToString();
this.CompanyConnection.UserName = oRS.Fields.Item("U_UserName").Value.ToString();
this.CompanyConnection.Password = oRS.Fields.Item("U_PassWord").Value.ToString();
if (oRS.Fields.Item("U_ServerType").Value.ToString() == "MSSQL2005")
{
this.CompanyConnection.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005;
}
if (oRS.Fields.Item("U_ServerType").Value.ToString() == "MSSQL2008")
{
this.CompanyConnection.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008;
}
if (oRS.Fields.Item("U_ServerType").Value.ToString() == "MSSQL2012")
{
this.CompanyConnection.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;
}
int iResult = this.CompanyConnection.Connect();
if (iResult == 0)
{
this.ConnectionSucceeded = true;
}
else
{
this.ConnectionSucceeded = false;
}
Kind Regards,
Evangelos D. Plagianos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
111 | |
8 | |
8 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.