on 03-31-2015 10:54 AM
Hello experts.
Please suggest me how to properly handle the events aet_ShutDown and aet_CompanyChanged.
When you close the application case is quite obvious, Addon child should be stopped.
What should I do when changing company?
I am quite often facing the issue AddOn remains in task manager or AddOn refuses to start when changing company.
How can I avoid these problems?
Best regards,
Pawel
Hi Pawel,
Add AppEvent to your application In main method of your Program class in Program.cs as follows.
Application.SBO_Application.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
Here is the implementation of the event.
static void SBO_Application_AppEvent(SAPbouiCOM.BoAppEventTypes EventType)
{
if (EventType == SAPbouiCOM.BoAppEventTypes.aet_ShutDown)
{
// you can write code to remove your menu items if you have.
Environment.Exit(-1);
}
}
Hope this will help.
Regards,
J S L Geeganage
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I think you should close your add-on when changing the company. Because your add-on will run automatically when you log in, if you have registered your add-on by selecting its group as automatic.
Environment.Exit(-1);
Consider the placing above line in change company block as well. And the code in my above reply will solve the problem of 'add-on keep running after close the SAP'
Regards,
J S L Geeganage
Hello.
Anyone else has any idea how to ensure AddOn works stable, reliable, and does not stay in memory or causes an error in the time of the change of the company?
Regards,
Pawel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure:
void SBO_Application_AppEvent(BoAppEventTypes EventType)
{
try
{
switch (EventType)
{
case BoAppEventTypes.aet_CompanyChanged:
case BoAppEventTypes.aet_ServerTerminition:
case BoAppEventTypes.aet_ShutDown:
customMenuItems.RemoveMenuItems(be1App.SapApp);
System.Environment.Exit(0);
break;
}
}
catch
{
}
}
Hi Pawel,
Your code looks ok.
Can you debug and make sure, the RemoveMenuItems does not throw error ?
or Just to be sure, can you copy your System.Environment.Exit(0);
into your catch block ?
void SBO_Application_AppEvent(BoAppEventTypes EventType)
{
try
{
switch (EventType)
{
case BoAppEventTypes.aet_CompanyChanged:
case BoAppEventTypes.aet_ServerTerminition:
case BoAppEventTypes.aet_ShutDown:
customMenuItems.RemoveMenuItems(be1App.SapApp);
System.Environment.Exit(0);
break;
}
}
catch
{
System.Environment.Exit(0);
}
}
Regards
Edy
User | Count |
---|---|
100 | |
11 | |
11 | |
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.