Skip to Content
0
Sep 04, 2018 at 08:52 PM

How to capture Add-On load event?

97 Views

I am developing a small add-on and I need to connect to the DI API. I have already made the connection but I realize that this procedure is executed every time I open the SAP add-on form, it is normal?, I have seen that other add-ons show a message of success the first time loads the SAP. So, where should I place my API connection code? How do I capture the event when the add-on is loaded? I had thought of capturing that event and from there execute the connection procedure to the DI API which is the following:

// Connect AddOn
{
this.oApp = Application.SBO_Application;
this.oCompany = ((SAPbobsCOM.Company)(this.oApp.Company.GetDICompany()));
Application.SBO_Application.StatusBar.SetText("Add-On connected: " + appName, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("Error connecting Add-On " + appName + " a SAB B1: " + ex.Message, "Error Connection", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
}