cancel
Showing results for 
Search instead for 
Did you mean: 

Sap 9.2 AddOn connection and SboGuiApi connection

Former Member
0 Kudos

Hello everyone!

I have this situation.

A AddOn works with DI Server to manipulate some orders and the same AddOn have two events filters programmed. One MenuEvent and one ItemEvent. This worked fine in SAP B1 9.1, but in the 9.2 version no.

What is going on. If I pass the AddOn connection string to the Events Class, to set in SboGuiApi, the AddOn crashes in the starting. Show a token connection error.

If I set the connection inside the Events Class to SboGuiApi using

SBO_Application = B1Connections.theAppl;

The events still work, but the Form methods stops to work.

This

[B1Listener(BoEventTypes.et_FORM_DATA_ADD, true)]  public virtual bool OnBeforeFormDataAdd(BusinessObjectInfo pVal)

and this

[B1Listener(BoEventTypes.et_FORM_DATA_UPDATE, true)]  public virtual bool OnUpdate(BusinessObjectInfo pval)

stops to work.

Some ideas? How can I fix this?

Thanks a lot!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Pedro.

Thanks a lot for your help! I saw some topics explaning about the "addonIdentity". This was be my next step. But, before I try this. I put this line

var sConnectionString = B1Connections.connStr;

inside the Events Class and finally the AddOn worked correctly!!

So, I still learning more every day about the SAP B1 development!

Thank you very much!

Answers (4)

Answers (4)

pedro_magueija
Active Contributor
0 Kudos

Hi João,

I've noticed you're passing in an "addonIdentity". That's used when you have generated an id and requested a license from SAP that contains that id for your addon. More info here: https://archive.sap.com/discussions/thread/25126

Otherwise, it should be null.

Pedro Magueija

LinkedIn | Twitter | Blog

Former Member
0 Kudos

Update: If I pass the

cnnStr

to Events Class like parameter, the AddOn stops in the connection and the client shows a message like that Error connection, token problem.

Former Member
0 Kudos

Hi Pedro. I understand your explanation. I guess it´s could be a conflict between connections and objects. Below part of the codes:

AddOn connection

cnnStr = System.Environment.GetCommandLineArgs().Length == 1 ? B1Connections.connStr : System.Environment.GetCommandLineArgs().GetValue(1).ToString();  

try  {  

retCode = B1Connections.Init(cnnStr, addOnIdentity, cnnType);  

if (retCode != 0)  {  

System.Windows.Forms.MessageBox.Show("ERROR - login Connection failed: " + B1Connections.diCompany.GetLastErrorDescription());  

return;  

}  

new Integrador();  

EF ef = new EF(); // events class  

System.Windows.Forms.Application.Run();  

}  

catch (Exception ex)  {  

System.Windows.Forms.MessageBox.Show("ERROR - load Connection failed: " +  ex.Message);  }

Events Class connection

private void SetApplication()  {  

SBO_Application = B1Connections.theAppl;  

}  

private void SetFilters()  {     

oFilters = new SAPbouiCOM.EventFilters();  

oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_CLICK);  

oFilter.AddEx("139"); // Orders Form  

oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_MENU_CLICK);  

oFilter.Add(139); // Orders Form  SBO_Application.SetFilter(oFilters);  }  

public EF()  {  

SetApplication();  

SetFilters();     

SBO_Application.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);     

SBO_Application.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);  

}
pedro_magueija
Active Contributor
0 Kudos

Hi João,

A AddOn works with DI Server to manipulate some orders and the same AddOn have two events filters programmed.

Note that DI Server is an actual component that uses SOAP messages to communicate with B1. I think what you mean is DI API (the data interface) of the SDK. Am I assuming correctly?

If I pass the AddOn connection string to the Events Class, to set in SboGuiApi, the AddOn crashes in the starting.

Can you show us the code where this is being done (and mark the error line with a comment)?

If I set the connection inside the Events Class to SboGuiApi using

SBO_Application = B1Connections.theAppl;

The SboGuiApi is a class used to establish connections to the UI server (SAPbouiCOM), the Application object, however (the one in B1Connections.theAppl), is an object that represents the client itself (B1).

I've noticed you're using B1DE, and normally, it takes care of setting up the event system and assigning the application object to another variable doesn't interfere with the process.

Without more details, it's hard to guess what might be the issue.

If you can please post the code for the connection of your addon to B1 and we'll start there.

Pedro Magueija

LinkedIn | Twitter | Blog