on 11-03-2005 8:08 AM
Hi all!
I've this question.
When I click "Stop" in Add-On manager, my add-on ends, but SAP Business One sends the error message "Failed to stop add-on".
My source code is:
Private Sub SBO_Application_AppEvent(ByVal EventType As SAPbouiCOM.BoAppEventTypes) Handles SBO_Application.AppEvent
Select Case EventType
Case SAPbouiCOM.BoAppEventTypes.aet_CompanyChanged
End
Case SAPbouiCOM.BoAppEventTypes.aet_ShutDown
End
Case SAPbouiCOM.BoAppEventTypes.aet_ServerTerminition
End
End Select
End Sub
Someone can help me?
Hi all,
There's recently been a SAP note brought out that provides a solution to this problem. The note number is 891115 and can be found at the following address:
For those of you without SAP Marketplace access, the solution is to create a global thread and then call the sleep method of the thread to create a slight delay before calling the exit method of the application.
In C#, the code looks something like this (sorry for the lack of indentation but that's the fault of this forum :P):
using System
using System.Threading
namespace myNameSpace
{
public class SubMain
{
private Thread oThread;
private SAPbouiCOM.Application m_sboApp;
public SubMain()
{
ThreadStart oThreadDelegate = new ThreadStart(SubMain.ShutDown);
oThread = new Thread(oThreadDelegate);
SetApplication();
}
public void SetApplication()
{
// Usual connection code goes in here
...
...
this.m_sboApp.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(this.m_sboApp_MenuEvent);
this.m_sboApp.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(this.m_sboApp_ItemEvent);
this.m_sboApp.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(this.m_sboApp_AppEvent);
}
private void m_sboApp_AppEvent(SAPbouiCOM.BoAppEventTypes AppEventType)
{
// Respond to application events and close the addon
switch(AppEventType)
{
case SAPbouiCOM.BoAppEventTypes.aet_ShutDown:
case SAPbouiCOM.BoAppEventTypes.aet_ServerTerminition:
case SAPbouiCOM.BoAppEventTypes.aet_CompanyChanged:
{
oThread.Start();
break;
}
}
}
private static void ShutDown()
{
System.Threading.Thread.Sleep(100);
System.Windows.Forms.Application.Exit();
}
}
}
I've tested this only on 2004A so far and only in C# but it works fine for me.
Hope this helps,
Owen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your clear answer. I had access to "SAP Marketplace" and found note number is 891115 which says "You can find the zipped sample as an attachment". I downloaded it through "SAP Download Manager" Version 2.1.130. However I could not unzip it. It was something like a MIME attachment. It could not be opened by Winzip. I only have Business One, could you please refer me to a URL where viewing instructions for non R/3 users are given
Hi All,
Try to delete your object after disconnecting from the Company with the Garbage Collector.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Hi All,
>
> Try to delete your object after disconnecting from
> the Company with the Garbage Collector.
Damien,
I have positively confirmed using the "Windows Task Manager" that Add-on is shutdown.
In B1DE, following was the handler:
public override void OnShutDown(){
B1Connections.diCompany.Disconnect();
B1Connections.diCompany=null;
B1Connections.theAppl=null;
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
System.Windows.Forms.Application.Exit();
return;
}
It appears to be a bug in 2004, as despite successful shutdown of Add-On, it still issues "Failed to stop Add-On" message although Add-On process disappeared from "Windows Task Manager".
I have the same problem.
Any help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Trinidad,
I am using B1DE for 2004. I am getting the same error. I tried the following and still getting the annoying "Failed to stop Add-on". Can you please help
public override void OnShutDown() {
// ADD YOUR TERMINATION CODE HERE ...
B1Connections.theAppl.StatusBar.SetText("Shutting down my add-on", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success) ;
B1Connections.diCompany.Disconnect();
B1Connections.theAppl=null;
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
System.Windows.Forms.Application.Exit();
}
User | Count |
---|---|
103 | |
12 | |
11 | |
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.