on 10-08-2008 10:32 AM
Hi, all,
I have a add-on to add menu items, it is startup automatically.
The menu items was added and works fine.
However, when I go to Add-On Manager, I found that the Add-On Status is "Failed".
Any ideas?
Hi,
Are you using the ard file to register the addon? Does the MD5 signature tag in the ard file match your addon executable?
Is there any abnormal error message in B1 status bar?
Also please recheck the code in your addon, and make sure you are using the correct connection string which was given thru the argument of your addon when you are calling CSboGuiApi::Connect(string connStr), is there any exception thrown out?
Regards,
Jay.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
most people in this forum had this problem when they had a mistake in their
SetApplicatoin or
SetConnectionConntext
procedures.
correct it looks like this (c#)
private void SetApplication() {
// *******************************************************************
// Use an SboGuiApi object to establish connection
// with the SAP Business One application and return an
// initialized appliction object
// *******************************************************************
SAPbouiCOM.SboGuiApi SboGuiApi = null;
string sConnectionString = null;
SboGuiApi = new SAPbouiCOM.SboGuiApi();
// by following the steps specified above, the following
// statment should be suficient for either development or run mode
try
{
sConnectionString = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));
}
catch
{
System.Windows.Forms.MessageBox.Show("AddOn must start in SAP Business One");
System.Environment.Exit(0);
}
// connect to a running SBO Application
try
{
// If there's no active application the connection will fail
SboGuiApi.Connect(sConnectionString);
}
catch
{ // Connection failed
System.Windows.Forms.MessageBox.Show("No SAP Business One Application was found");
System.Environment.Exit(0);
}
// get an initialized application object
globals.SBO_Application = SboGuiApi.GetApplication(-1);
}
private int SetConnectionContext()
{
int setConnectionContextReturn = 0;
string sCookie = null;
string sConnectionContext = null;
// // First initialize the Company object
globals.oCompany = new SAPbobsCOM.Company();
// // Acquire the connection context cookie from the DI API.
sCookie = globals.oCompany.GetContextCookie();
// // Retrieve the connection context string from the UI API using the
// // acquired cookie.
sConnectionContext = globals.SBO_Application.Company.GetConnectionContext(sCookie);
// // before setting the SBO Login Context make sure the company is not
// // connected
if (globals.oCompany.Connected == true)
{
globals.oCompany.Disconnect();
}
// // Set the connection context information to the DI API.
setConnectionContextReturn = globals.oCompany.SetSboLoginContext(sConnectionContext);
return setConnectionContextReturn;
}
lg David
Hi, David,
thanks for your code.
I am using VB.NET,
here is my code, seems no different.
Private Sub SetApplication()
Dim SboGuiApi As SAPbouiCOM.SboGuiApi
Dim sConnectionString As String
SboGuiApi = New SAPbouiCOM.SboGuiApi
sConnectionString = "0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056"
Try
SboGuiApi.Connect(sConnectionString)
Catch
System.Windows.Forms.MessageBox.Show("No SAP Business One Loaded")
End
End Try
SBO_Application = SboGuiApi.GetApplication()
End Sub
Private Function ConnectDIfromUI() As Boolean
Dim cookie As String
Dim constr As String
Dim retval As Integer
If (IsNothing(SBO_Company)) Then
SBO_Company = New SAPbobsCOM.CompanyClass
End If
cookie = SBO_Company.GetContextCookie
constr = SBO_Application.Company.GetConnectionContext(cookie)
If SBO_Company.Connected Then
SBO_Company.Disconnect()
End If
retval = SBO_Company.SetSboLoginContext(constr)
If (retval <> 0) Then
Trace.WriteLine("Connection Fail !!")
Else
retval = SBO_Company.Connect
End If
Return SBO_Company.Connected
End Function
Thanks
Hello,
Try to debug your addon in the code. Maybe this clears your problem.
HTH
Regards,
Teun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
10 | |
6 | |
6 | |
4 | |
3 | |
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.