Thursday, December 19, 2013

Getting Started with Accpac Programming

Recently I have accepted a new position at Kerr Consulting that specializes in integrating ERP and other financial software packages such as Quick Books with existing software. Most of our work is related to Sage products and I have been specifically tasked with becoming an expert at Sage 300 ERP (Accpac) programming.

A Simple Example

I find it difficult to find simple examples when getting started programming any new platform. So I will start out with a very basic example of how to simply connect to Accpac.


  • We are programming with the .NET Framework version 4.5 and MS Visual Studio 2012. There is no problem with downgrading to lower versions of .NET and Visual Studio.
  • We are using Sage 300 ERP 2012/ 6.1 for the example code. This must be installed on your system in order to write software for sage.
  • Additionally you will need to install the Sage 300 ERP SDK v2012 that should be provided for you. The installation is named SDK61A.exe in my system.


You must make a reference to the AccPac COM library in order to access the SDK in .NET. Under your project right click on References and click Add Reference… Then click on the COM tree node on the left hand side of the form. Check the item named ACCPAC COM API Object 1.0 and then click ok to finish adding the reference. You can see where I have added the reference to my project below:

The Code

After your reference is added to your project the below code can be used to connect to Accpac and retrieve the Application Version you are programming on.

namespace Example1
    class Program
        static void Main(string[] args)
            var accpacSession = new AccpacSession();

            //Initialize the session. You will need to pass another version instead of 61A.
            //for AppVersion. I am using 6.1A so I pass 61A here.
            accpacSession.Init("", "XY", "XY1000", "61A");

            //This is the default setup for SAMINC but it might be different on your system
            accpacSession.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Now, 0, String.Empty);

            //Write out the Application Version. It should be 61A just as you passed to Init.

            //Always close the session when you are done.

Where to Get More Help

  • The best resource for SDK help is Stephen Smith’s blog. There is a ton of information there that you won’t find anywhere else including the Sage documentation.
  • There is also a wiki page for Sage 300 ERP that has a variety of examples. However, you will have to be a member of the developer network to view or updated it.

1 comment: