How to use existing session using COMAPI in C#

By | July 29, 2019

In this blog, we are going to define the use of an existing Sage 300 ERP session with COMAPI in C# .Net. We have already seen about “Create New Session using COMAPI in C#” in our earlier blog. Since we already know that session is must to interact with Sage 300 and for some developers when they do not have enough knowledge about the Sage 300 API it becomes tedious job to use the same. This will be using an existing License and not consume an additional LanPak Users License per session. We will be looking into the steps for using it with C# .Net Code.

New Stuff:  How to use existing session using Advantage API in C#

Step 1:

Include the Sage 300 COMAPI and Session Manager in the project.

Step 2:

Once the COMAPI is included, declare the variable for SingonID and Session. Create the object of Session Manager.

AccpacSession _accpacSession;

int lSignonID = 0;

AccpacSessionManager.AccpacSessionMgr accpacSessionMgr = new AccpacSessionManager.AccpacSessionMgr();

Step 3:

Pass the Sage 300 information and use the existing session to connect to Sage 300 ERP.

accpacSessionMgr.AppID = “AS”;

accpacSessionMgr.ProgramName = “AS3001”;

accpacSessionMgr.ServerName = “”;

accpacSessionMgr.AppVersion = “65”;

accpacSessionMgr.CreateSession(“”, ref lSignonID, out _accpacSession); The application has now connected to existing session of Sage 300 ERP and ready to be used for interaction

About US:-

Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix offers unique GUMU™ integrated solutions of Sage 300 with Sage CRM, Salesforce.com and Magento eCommerce along with Sage 300 Migration from Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business Works. We also offer best-in-class Sage 300 customization and development services and integration service for applications such as POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP and in Sage 300c development services we offer services such as upgrades of older codes and screens to new web screens, newer integrations using sdata and web services  to Sage business partners, end users and Sage PSG worldwide. Greytrix offers over 20+ Sage 300 productivity enhancing utilities that we can help you with such as GreyMatrix, Document Attachment, Document Numbering, Auto-Bank Reconciliation, Purchase Approval System, Three way PO matching, Bill of Lading and VAT for Middle East.

For more details on Sage 300 and 300c Services, please contact us at accpac@greytrix.com. We will be glad to assist you.