Stephen Smith's Blog

Musings on Machine Learning…

An Introduction to the Sage 300 ERP .Net API

with 165 comments


Introduction

I’m planning to write a series of blog articles on the Sage 300 ERP API and in particular on the .Net API that has been part of Sage 300 since version 5.1A. I have a couple of goals with these articles:

  1. Provide a deeper and more complete explanation of many parts of our API. Although all the samples in this series will be in C# and use the .Net API, the ideas will apply to integrating to Sage 300 via any of our other APIs including COM, Java, XAPI, etc.
  2. Explore a number of newer .Net technologies and look at how these can be integrated to Sage 300. These may include things like LINQ and ASP.Net MVC.

The goal is to start simple and then to progress to deeper topics. I’m sure I’ll have blog postings on other topics in-between, but look for this series to continue over time.

I’ll be developing all these projects using the latest C#, Visual Studio and .Net framework. I’ll post the full project source code for anything mentioned. So to start these will be Visual Studio 2012, but I’ll switch to 2013 after it’s released. I’m also currently running Sage 300 ERP 2014, but these examples should work for version 5.6A and later.

Caveats

When you use the Sage 300 .Net interface you can’t share any objects with Sage 300 COM objects or ActiveX screen controls we use in our VB6 programming framework. If you want to use any of the COM/ActiveX controls then you must use the Accpac COM API. When you use the .Net interface you don’t have any interoperability with the other VB6 related technologies. From .Net you do have full access to our COM API via .Net’s COM Interop capability.

Generally this is ok. If you are integrating a .Net product or writing an integration to something like a Web Server then you don’t want any of this anyway. But to just point this out up front. That you cannot use a .Net session object anywhere in a COM/ActiveX API. The COM/ActiveX session object is something that is similar but not interchangeable.

Documentation and Samples

Some versions of Sage 300 have included the help file that contains the .Net interface reference manual. However this isn’t universally available. To help with this I’ve put a copy on Google Drive for anyone that needs it, located here. Note that when you download help files over the Internet, Windows will mark them as dangerous and they may not open, to get around that, have a look at this article.

Of course within Visual Studio, since our API is completely standard .Net, you will get full Intellisense support, so Visual Studio can give you a list of property and method names as you type along with giving you the argument list for the various methods.

I’ll make the projects that are described in this series of blog posts available here. The one for this article is WindowsFormsApplication3 which then reminds me I should fill in the dialog box properly when I create a new project.

There is additional documentation on our DPP Wiki, but you need to be a member of the DPP program to access this.

Project Setup

First you must have Sage 300 ERP installed and you not have de-selected the “Sage 300 ERP .Net Libraries” in the installation program when you installed the product. Then after you create your Visual Studio project (of whatever type it is), you need to add two references: ACCPAC.Advantage.dll and ACCPAC.Advantage.Types.dll. Both of these will have been installed into the .Net GAC. It’s usually worth adding a “using ACCPAC.Advantage;” statement to the beginning of source files that access our API, since it saves a lot of typing of ACCPAC.Advantage.

Now you are ready to use the Sage 300 ERP API. In this first articles I’m going to create a simple .Net Windows Forms C# application, put a button on the form and on click exercise various parts of the API. Nothing exciting will happen but we will print out some output to the console to see whether things are working.

vs1

Creating and Using a Session Object

I talked a lot about creating sessions in this article, mostly from the COM point of view. Now we’ll recap a bit, but from the .Net point of view. The first thing you need to do when using our API is to create and initialize a session object.

using ACCPAC.Advantage;
private Session session;
session = new Session();
session.Init("", "XY", "XY1000", "62A");

At this point you have a session that you can use. For our purposes here session.Init is very important that it is called and nothing else will work until it is called, but the parameters aren’t that important at this point. We’ll come back to them later, but you can just use the ones in the above example for most purposes.

Although we aren’t signed on yet there are still some things we can do with the session object like get a list of the companies, which is something that is required to build a signon dialog box.

foreach ( Organization org in session.Organizations )
{
   Console.WriteLine("Company ID: " + org.ID + " Name: " +
       org.Name + " Type: " + org.Type);
}

Notice that the session’s Organizations property is a standard .Net collection and as a result we can use any C# language support for dealing with collections such as the foreach statement shown. Generally in our API we’ve tried to make sure everything is presented in a standard way for .Net programmers to use. Another very useful collection on the session is the Errors collection which is a collection of all the error messages (including warnings and informational) since it was last cleared. We’ll cover the usefulness of the Errors collection in a future article.

Now let’s actually sign on to Sage 300:

session.Open("ADMIN", "ADMIN", "SAMINC", DateTime.Today, 0);

Basically you need to provide the same sort of information that a user would sign-on to the desktop. Note that although the user id and password are forced to uppercase in the desktop’s sign-on dialog, they are actually case sensitive at the API level, so you must enter these in upper case. Also note that the session date is given as a standard .Net date type.

Now that you are signed on, you can start to do more things. We can now start to access the database. This API was created before we duplicated the system database into the company database, but from the session you can get at some old system database tables like the currencies (which are now read from the copy in the company database). But to really start using the database you need to create a DBLink object from the session object. To do this you specify whether you want a link to the company or system database (which will pretty much always be Company now). Plus you specify some flags, like whether you need read-write or read-only access.

private DBLink mDBLinkCmpRW;
mDBLinkCmpRW = session.OpenDBLink(DBLinkType.Company, DBLinkFlags.ReadWrite);

Now that we have a database link we can directly access some things like the company information, fiscal calendars and the list of active applications for this company. But the main use of this object is to open the Sage 300 ERP business logic objects which we typically call Views.

Summary

So far we’ve only managed to open a session and start using a few basic .Net objects. But these are the starting point to any project so we needed to take a bit of time to set the stage for future articles. Next time we’ll start to create View objects from our DBLink objects and start to explore some View functionality.

If you have any opinions on the coding style, the use of C# or any other questions, please leave a comment for the article and I’ll try to address them.

Written by smist08

October 12, 2013 at 4:57 pm

165 Responses

Subscribe to comments with RSS.

  1. […] Introduction I’m planning to write a series of blog articles on the Sage 300 ERP API and in particular on the .Net API that has been part of Sage 300 since version 5.1A. I have a couple of goals wi…  […]

  2. BLOGSTAR!

    Keep up the Excellent work, really looking forward to future articles in this series.

    Please zip examples in Drive, individual file downloads are cumbersome.

    Aslan Kanzas

    October 14, 2013 at 9:12 pm

    • Good point. I added a zipped version of this one and will continue to do that in the future.

      smist08

      October 14, 2013 at 11:50 pm

  3. Dear Stephen,

    I love to read your blog. Thank you for sharing your knowledge with world.

    Thanks Again,

    Sincerely,
    Rajesh

    Rajesh

    October 19, 2013 at 8:42 am

    • Hi Rajesh,
      Have you tried to reading custom fields under A/R Customers under optional fields tab.

      Peace,
      Phaneendra

      Phaneendra

      October 29, 2013 at 12:55 pm

  4. […] Last time we used the Sage 300 ERP .Net Interface to open a session and create a database link to a Sage 300 ERP company. In this article we will start to investigate how to use the API to manipulate the Sage 300 ERP business logic. The individual business logic objects are known as Views (not to be confused with the Views in MVC or SQL Server Views). For a bit more background on the Views have a look at this article. […]

  5. Hi, Good to read it. But can i know how can we access optional fields defined under A/R Customers using the .net api

    Phaneendra

    October 29, 2013 at 12:53 pm

    • Hi, Good to read it. But can i know how can we access optional fields defined under A/R Customers using the .net api

      Phaneendra

      October 29, 2013 at 12:59 pm

    • Optional fields are always implemented as a detail view to the thing they are optional fields for. So AR0400 (ARCUSO) is a detail view to AR0024 (ARCUS). I’m just starting to talk about handling header/detail views, but will have more in future articles.

      smist08

      October 29, 2013 at 7:03 pm

      • Hi,
        I have a doubt, how AR0024 is mapped to ARCUS

        Phaneendra

        October 31, 2013 at 9:24 am

      • Often macro recording what you are trying to emulate can help quite a bit.

        smist08

        November 3, 2013 at 1:12 am

  6. Dear Stephen,
    thanks for your great information , i want to ask you qustion i am creat macro that create order entry shipped and invoiced directly when i try it on test data its creat order entry shipped and invoiced but when i try it on another company and change item and everything its only create order entry not shipped and invoiced why this happened??????

    shady

    December 14, 2013 at 12:23 am

    • Usually its something like a required optional field. You might try entering an order/shipment/invoice in their system to see what extra fields they require. Also be mindful of security in case the user you are running the macro as doesn’t have rights.

      smist08

      December 14, 2013 at 12:45 am

      • but the code on test company with no change work but when i try to another company customized whith optional field start and end date its not shipped and invoiced the order entry is that coz optional field ????i am recorded the macro when i logged as admin

        shady

        December 14, 2013 at 12:54 am

      • Also have a look to see if there are any warnings or other messages in the sessions errors collection.

        smist08

        December 14, 2013 at 12:57 am

  7. this on i cant do it how i can look to sessions errors collection. in vb.net ???please help

    shady

    December 14, 2013 at 1:02 am

  8. i try ACCPACErrorHandler there is no error but what make me crazy the code on test company work but on the other company work but not shipped and invoiced. :/

    shady

    December 14, 2013 at 1:24 am

    • thanks the error was in Fical calender for OE Period 12 🙂

      shady

      December 14, 2013 at 1:44 pm

  9. […] the past few weeks we’ve been playing around with the Sage 300 ERP .Net API and we’ve progress from working with WinForms projects to ASP.Net MVC projects. In this article […]

  10. Hi I am new to using ACCPAC COM API. Our client has created a user name and password which signs onto the desktop app but gives us “user not assigned error” Any thoughts?

    Sedick

    December 23, 2013 at 9:10 am

  11. […] Accpac.Advantage.dll: This is the main external interface for our .Net API. For more on our .Net API see the series of articles starting with this one. […]

  12. HI,I Want to drag gl2100.ocx to winform ,but it popup message,Failed to import ActiveX control. Make sure it is properly registered.how ?

    linson

    March 13, 2014 at 11:57 am

    • This is usually caused by one of a couple of things. 1. There are a couple of bad versions of the .Net runtime, choosing a later version for your project often helps. 2. Data Execution Protection is turned on by default in newer Visual Studios, this is solved in our product in the newest product update for the 2012 version or using the 2014 version.

      smist08

      March 13, 2014 at 3:20 pm

      • Thanks for you help.
        would you told me your development environment?
        windows version(win7 or win2003 server 32bit or 64bit ) and Visual Studios version.
        thanks.

        linson

        March 18, 2014 at 12:50 pm

      • I’m running Windows 7 64 Bits, Visual Studio 2013 and .Net 4.5.1.

        smist08

        March 18, 2014 at 1:46 pm

      • i install new os(win7 64b sp1) ,accpac (accpac 6.1) and .net 4.5.1 ,but it still no work.
        same error message,”Failed to import ActiveX control. Make sure it is properly registered”
        but accpac fieldedit control and some dlls in accpac runtime floder can work.
        step 1
        choose items–>com components–>choose accpac gl2100.
        2.
        drag item to form

        Thank you all the same.

        linson

        March 19, 2014 at 11:25 am

      • Do you have the latest Product update for Sage 300 2012? This is necessary to work.

        smist08

        March 19, 2014 at 9:14 pm

  13. Hey i m getting “Invalid singon information” message.On this line
    session.Open(“BAZ”, “Bb@12345”, “IND09”, DateTime.Today, 0);
    On my sage system there is windows authentication.My User id n password which i provide is windows id and password and “IND09” is my database name which get from sql server object explore.
    I know i m doing somewhere wrong
    My newbabie for all those thing please provide me guidance.
    My questions are :
    1.From where to take company id or database id in replace of “IND09”?
    2.What to write user id and password when authentication is Windows Authentication?

    So for bad English.

    Kaustubh B K

    March 14, 2014 at 12:47 pm

    • Hi I am also having the same problem to you.
      Dim SageSess As New ACCPAC.Advantage.Session
      SageSess.Init(“”, “CS”, “CS0000”, mdSageVer)
      SageSess.Open(UCase(txt_Usr.Text.Trim()), UCase(txt_Pwd.Text.Trim()), mdSageDb, DateTimePicker1.Value, 0)
      Dim mDBLinkCmpRW As ACCPAC.Advantage.DBLink
      mDBLinkCmpRW = SageSess.OpenDBLink(DBLinkType.Company, DBLinkFlags.ReadWrite)
      I dont know why i cannot login or Open sage session. Even my old project that used to open, Now all are cannot Open.

      Please advise me.

      Sakada

      March 28, 2014 at 9:01 am

    • If you use the open method then it will use the Sage 300 User Id. If you want to use the Windows credentials then you need to use the OpenWin method to open the session.

      smist08

      March 28, 2014 at 4:12 pm

      • Hi, I am using sage 300 as above code, but i still cannot login. Could you advise me?

        Sakada

        March 28, 2014 at 4:18 pm

  14. please help

    i am open session like this

    Session = New AccpacCOMAPI.AccpacSession
    Session.Init(“”, “CS”, “CS0000”, “56A”)
    Session.Open(“ADMIN”, “ADMIN”, “SHASD”, DateTime.Today, 0, “”)

    when i try to connect it to accpac 6.1 database its work fine when i try to open view
    but when i connect to accpac 5.6 database i cant open view “Error when opening view PO7060”
    and when i go to DataBase Setup and try to edit company link this error message appear
    incorrect procedure .you cant edit this company while sage 300 erp is signed in exit sage 300erp and retry.

    please any idea????

    shadi

    April 10, 2014 at 11:55 am

  15. steph i need ur help plz

    shadi

    April 10, 2014 at 7:47 pm

    • To get into database setup you could reboot to kill anything still running (or start taskmgr and kill any a4w* processes). One thing for 5.6 is that the .Net libraries were optional in the install and you needed to select them, perhaps they need to be added in this case.

      smist08

      April 10, 2014 at 7:51 pm

  16. i remove .net 2012 setup from my pc and install 5.6 .net library on my pc and the remote pc have 5.6 but still cant open view but on the same remote pc its open view

    shadi

    April 13, 2014 at 7:23 am

  17. i am use accpacCOMAPI.dll not ACCPAC.Advantage.dll

    shadi

    April 13, 2014 at 8:07 am

    • Can you run the normal UIs? These use the same methods. Are you entering the user id an password in upper case (it is case sensitive, even though the desktop upper cases these)? Perhaps use COM Spy (or Accpac Spy) to spy of the session objects to see if it gives a clue as to what is going on.

      smist08

      April 13, 2014 at 4:33 pm

  18. i am now try ACCPAC.Advantage.dll but the same error cant open view :/ stephien how can i solve this issue i am tired :/

    shadi

    April 13, 2014 at 9:30 am

    • Can you give me the Error? maybe i used to have and solved it.

      Sakada

      April 13, 2014 at 10:58 pm

    • Have you tried putting an exception handler around it and checking the session.errors object to see if there is a string error message?

      smist08

      April 13, 2014 at 11:18 pm

  19. this message now appear : system error write down the message ,error and source codes .exit 300 ERP and windows .restart and retry the operation.

    the Old message : cant open view

    is the reason coz i install 6.1 on my pc and try to remote 5.6 pc from my pc ?????

    but i uninstall .net library 6.1 from my pc and install .net 5.6 library

    shadi

    April 14, 2014 at 6:30 am

  20. and in the setup screen when i try to edit DAT company this message shown : Incorrect procedure . you cant edit this company while sage 200 signed in exit sage 300 .

    this message hang for time
    and i i am not logged in the company :/

    shadi

    April 14, 2014 at 6:34 am

  21. its work by removing 6.1 and install 5.6 on my pc its connect perfectly why both not working :/

    shadi

    April 14, 2014 at 12:48 pm

    • We don’t support installing multiple versions at once. We only support one version installed at a time.

      smist08

      April 14, 2014 at 11:37 pm

  22. hi

    Stephen really i am appreciate your help coz u give good help

    i have one more point about database i want to add trigger on table after insert record i want to change some value is this good ????

    i can make my trigger on DB of ACCPAC with no effect on ACCPAC system work ???

    Really Thanks

    shadi

    April 24, 2014 at 11:09 am

    • This is really very bad. It can cause all sorts of problems with weird errors and corrupted tables. Please only change our database using the View API.

      smist08

      April 25, 2014 at 2:21 am

      • but stephen i want to make triggers on the database to change optional fields values only and the status field is this bad too??

        i don’t want to change critical fields.

        thanks a lot stephen…….

        shadi

        April 30, 2014 at 7:59 am

    • please can you help me

      but stephen i want to make triggers on the database to change optional fields values only and the status field is this bad too??

      i don’t want to change critical fields.

      thanks a lot stephen…….

      shadi

      May 4, 2014 at 9:26 am

      • The problem is that triggers lead to very hard to diagnose problems. If your trigger fails, the Sage 300 ERP transaction that initiated the trigger will fail and be rolled back. The error reported will be completely cryptic. Then will call support who will run RVSpy/DBSpy which will see nothing.

        smist08

        May 4, 2014 at 4:20 pm

      • thanks stephen a lot 🙂

        shadi

        May 6, 2014 at 8:38 am

  23. Hi Stephen,

    I tried downloading the API Ref help file from the google drive link. But when run, it only showed me the properties/ methods (left panel) without the help content (on the right windows). So sorry, did I miss out anything.

    Many thanks in advance.

    et

    April 25, 2014 at 1:31 am

  24. […] An Introduction to the Sage 300 ERP .Net API Starting to Program the Sage 300 ERP Views in .Net Composing Views in the Sage 300 ERP .Net API Using the Sage 300 ERP View Protocols with .Net Using Browse Filters in the Sage 300 ERP .Net API Using the Sage 300 .Net API from ASP.Net MVC Error Reporting in Sage 300 ERP Sage 300 ERP Metadata Sage 300 ERP Optional Fields […]

  25. I am looking for a programmer who can create a basic asp.net based project which can talk to Sage300 and create/edit employee information. If interested please contact me at mattd@amviksolutions.com.

    Matt

    August 22, 2014 at 4:18 pm

  26. Hi Smith, I just read your blog.I have a question.
    Now i’m in project build a software from vb.net to integrate with accpac.
    I did the part from Vb.net to export file.
    But i’m still confused, how to import that file to accpac. Can I dirrectly import the file to accpac? or should I open the accpac first and then import the file?
    Any suggestions to make my concept better? Please i need your help.

    dev65

    August 25, 2014 at 9:33 am

    • Thankyou in advance 🙂

      dev65

      August 25, 2014 at 9:34 am

    • For the import/export built into the product you can use the COM AccpacImportExport COM object and call ExecuteImportScript or ExecuteExportScript (you need to save the script from the product’s import/export).

      You can also use the .Net API if you process the import your self, ie code reading the file and then use the API to insert the data into Sage 300.

      smist08

      August 25, 2014 at 6:22 pm

      • (Export data from vb.net, and import data to accpac)
        So,let’s say I need to build the accpacimportexport in vb.net code?
        The problem is my column name from database to export in vb.net, are not same like column in accpac. Should I synchronize the column header? but how?
        Sorry I’m newbie to use the accpac & vb.net.

        dev65

        August 26, 2014 at 5:33 am

      • That’s one of the things saved in the script. When you go into the export or import from the product you can map the fields. When you save the script, it saves this field mapping. This will then be used when you execute that script.

        smist08

        August 26, 2014 at 4:22 pm

  27. Hi Smith,

    I have a queries. I am doing a VB code where I insert the ActiveX screen control onto my program.
    1. How can I disable any prompt generated by the UI.
    Example, in I/C Shipment there is a prompt for “Negative shipment prompt when quantity is below on hand”, or a “Confirm to delete” prompt etc.

    I need to disable is because my coding is dong some auto insert/delete of the detail based on user action.

    2. I inserted a fec linking to the document no. I notice I can’t use the fec finder, there is always a error when user select a transaction no from the fec. It is because there is a “INIT” action auto return in the fec after user select a document no.

    Many thanks in advance.

    et

    August 25, 2014 at 9:16 pm

    • 1. Some UIs have extra properties that you can set to disable prompts, like O/E Order has to disable printing of order confirmations. I don’t think this UI has this, but you can disable this check in I/C Options.

      2. It might be you have to handle the OnKeyChanged event as below.

      Private Sub dsGLACCOUNT_OnKeyChanged(ByVal eReason As tagEventReason, ByVal pField As AccpacDataSrc.IAccpacDSField, ByVal pMultipleFields As AccpacDataSrc.IAccpacDSFields)
      If (eReason = RSN_FIELDCHANGE) And (dsGLACCOUNT.Exists = True) Then
      dsGLACCOUNT.Read
      End If
      End Sub

      Otherwise its something to do with how you configured the finder in its properties dialog.

      smist08

      August 26, 2014 at 3:37 am

  28. […] In this article I’ll show how to execute a custom SQL Query through a special Business Logic View to get at data for reporting purposes. This means you can use the full power of SQL Server to extract the exact data you want. This article uses our .Net API which I have blogged on quite a bit with an introductory article here. […]

  29. […] week, we looked a bit at using the Sage 300 ERP .Net API to do a general SQL Query which could be used to optimize calculating a KPI. In this case you could […]

  30. Hi Stephen, great articles, thank you! Are similiar .NET api’s available for “Sage 300 Construction & Real Estate” application as well? If this is the same thing, I am sorry.

    Drew Poggemann

    February 26, 2015 at 9:25 am

    • Sage 300 CRE is a very different product than Sage 300 ERP. Sage 300 ERP is a descendant of the Accpac ERP product and Sage 300 CRE is a descendant of Timberline. I’m not really sure what API or SDK have, you would need to contact their support department to find out.

      smist08

      February 26, 2015 at 9:36 am

  31. […] we will write a small .Net application that uses the Sage 300 API .Net API to process through the drill down information in the G/L Journal Header and process the A/P drill […]

  32. Thanks for some great articles! I had one question – you said that you can not use the AccPacCOMAPI class along with the AccPac.Advantage classes. I notice that the DBLink and Session classes do not have Close() methods but the COMAPI objects for sessions and db links do. If this is the case, does that mean you can not close the Advantage objects? Or is there a way to access them via their COMAPI “siblings” to access the ability to close open sessions and links?

    john

    March 3, 2015 at 7:17 pm

    • In the .Net API you have to call the dispose() method to close them.

      smist08

      March 4, 2015 at 2:29 am

  33. […] Logic) give you a great deal of power to perform Accounting operations through our various APIs. However as in any programming, performance must always be taken into account. The Sage 300 ERP […]

  34. Hi Guys,

    I have an issue when attempting to retrieve or insert data into SAGE databases using the SDK 61A.
    I am able to establish connection with the SAGE database and open the Views.
    However, I am getting a HRESULT E_FAIL error when I try to retrieve or insert data into SAGE 300 2012.

    Please see the code below:

    Public Function fSageTest() As Boolean
    Dim sSession As AccpacCOMAPI.AccpacSession
    Try
    sSession = New AccpacCOMAPI.AccpacSession
    sSession.Init(“”, “XY”, “XY1000”, “61A”)
    sSession.Open(“ADMIN”, “”, “HYLDAT”, DateTime.Now, 0, String.Empty)

    Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
    Dim vStockItems As AccpacCOMAPI.AccpacView

    mDBLinkCmpRW = sSession.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
    mDBLinkCmpRW.OpenView(“IC0310”, vStockItems)

    vStockItems.Init()
    vStockItems.Browse(“SELECT [ITEMNO], [DESC], [CATEGORY] FROM ICITEM “, True)

    While (vStockItems.Fetch())
    ”Do Something
    End While

    Catch ex As Exception
    fErr(“fSageTest”, 0)
    Return False
    Finally
    If Not sSageSession Is Nothing Then
    sSageSession.Close()
    End If
    End Try
    End Function

    The error is thrown when when executing the highlighted line.

    I am missing something?
    Could you please assist.
    I tried with both SDKs 61A and 62A wth same result.

    Complete error as below:

    System.Runtime.InteropServices.COMException was caught
    ErrorCode=-2147467259
    Message=”Error HRESULT E_FAIL has been returned from a call to a COM component.”
    Source=”Interop.AccpacCOMAPI”
    StackTrace:
    at AccpacCOMAPI.AccpacViewClass.Browse(String Filter, Boolean Ascending)
    at RICGMobilePlusCentre.clsSAGE300.fSAGETest()
    InnerException:

    Jose Joya

    August 11, 2015 at 11:36 am

  35. […] All server side programming above the Sage 300 .Net API is written in C#. This is a very powerful object oriented extension to C which is quite similar to […]

  36. Hello

    I have a problem about read Accpac Session

    I use ACCPAC COMAPI to call SessionManager My function :

    LogonWithSessionMgr(“”, 1, “XY”, “61A”, “XY0001”, “”)

    I have to specify a SessionID, here the 1 is SessionID .

    if I have 2-3 sessions each session has a different company

    Is there Any Accpac API function could show a screen about all the session I have and let me choose one

    Thanks for hlep

    rzhang

    September 24, 2015 at 7:59 pm

  37. I installed Sage ERP 300 and ticked the .NET SDK option however I cant seem to find the dlls. can you help me or give me an SDK 61A setup that I can run

    Michael McDermott

    October 28, 2015 at 12:32 pm

    • The should be there. They are installed to the GAC so they are usually in both the runtime folder and the GAC. If you don’t see them try running runtime\smdotnet.exe to see if it wants to install them (if it offers to modify or remove then they are already installed).

      smist08

      October 28, 2015 at 3:27 pm

  38. Hi Smith,

    I am new on sage SDK, Pls help me on switching from one company to another.

    example:
    I have logged-in into a database X, simultaneously i want to access a table ABC from Database Y.

    I am using SDK 62A, i want to do this in CVIEW,
    i read few blogs on DBLink, LnkOpen i am not clear on that, Pls request your help on this.

    manju

    October 30, 2015 at 11:45 am

    • You will need to call lnkOpen to open a link to company y and then open any views that you want on company Y using viewOpen with this link (after calling viewLoad). This is fairly easy as long as the modules you need are activated in both company X and Y. If you use the COM API then you can clone a given session to get a session to another company.

      smist08

      October 30, 2015 at 3:37 pm

      • Hi Smith,

        Thanks a lot for your reply,

        To call lnkOpen we required linkNo which will obtain on call of dbLink, Request you to post sample code for
        dbLink, lnkOpen and viewOpen

        Pls help on this 🙂

        manju

        October 31, 2015 at 6:47 am

  39. Hi Smith,

    Thanks a lot for your reply,

    To call lnkOpen we required linkNo which will obtain on call of dbLink, Request you to post sample code for
    dbLink, lnkOpen and viewOpen

    Pls help on this 🙂

    manju

    November 2, 2015 at 5:47 am

  40. Hi smith,

    Thanks a lot for your suggestions,

    I have coded using lnkOpen and viewOpen to access table OLORDLEH from DB DEVDAT i have logged-in into SAMLTD database,But i am unable to initialize the view, Working code as given, Pls help to find where i am going wrong.
    ——————————————————————–
    static ERRNUM chkccon(LPV lpv)
    {
    ERRNUM e=ERRNUM_SUCCESS;
    LPVIEWDEF olordleh=FindCmp(lpv,CMP_OLACCAUH_OLORDLEH);
    char str[50];
    LPWORD linkNo;
    DBSINT introto=1;

    MaxError(&e,lnkOpen(lpv->hpib, “DEVDAT”, FLG_READWRITE, linkNo));
    sprintf(str, “%d”, linkNo);
    rvspyTrace(str);

    MaxError(&e,viewOpen(olordleh->rvh, lpv->hpib, linkNo, olordleh->view));
    MaxError(&e,viewInit(olordleh->rvh,olordleh->view));
    MaxError(&e,lnkClose(linkNo));
    return e;

    }
    ———————————————-
    I doubt going wrong in linkno.

    manju

    November 3, 2015 at 9:40 am

    • You define a pointer with out asigning it to any storage. I think what you want is:

      WORD linkNo;

      MaxError(&e,lnkOpen(lpv->hpib, “DEVDAT”, FLG_READWRITE, &linkNo));

      smist08

      November 3, 2015 at 6:48 pm

      • Hi Smith,

        Once Again Thanks a lot for your support

        got solution for above doubt

        as i am going further i got error on calling viewInstanceOpen, As my code below….

        ——————————————-
        static ERRNUM chkccon(LPV lpv)
        {
        ERRNUM e=ERRNUM_SUCCESS;
        LPVIEWDEF olordleh=FindCmp(lpv,CMP_OLACCAUH_OLORDLEH);
        char str[50];
        WORD linkNo;
        VIEWLOADSTRUCT vls;

        MaxError(&e,lnkOpen(lpv->hpib, “DEVDAT”, FLG_READWRITE, &linkNo));
        sprintf(str, “%d”, &linkNo);
        rvspyTrace(str);

        ibGetRoto (lpv->hpib, &vls.iRotoInstance);
        vls.iTag = 1;
        strCopyBZ (vls.sPgmID, sizeof (vls.sPgmID), APPL);
        utlObjStrToID (“OL0102”, &vls.lViewID);
        viewLoadEx (&vls);
        viewInstanceOpen(olordleh->rvh, lpv->hpib, linkNo, cmpNameList[CMP_OLACCAUH_OLORDLEH].flags, NULL, 0, (LPV *)& olordleh->view);

        MaxError(&e,viewOpen(olordleh->rvh, lpv->hpib, linkNo, olordleh->view));
        MaxError(&e,viewInit(olordleh->rvh,olordleh->view));
        MaxError(&e,lnkClose(linkNo));
        return e;
        }
        ——————————————-
        I got error in

        1105-> viewInstanceOpen(olordleh->rvh, lpv->hpib, linkNo, cmpNameList[CMP_OLACCAUH_OLORDLEH].flags, NULL, 0, (LPV *)& olordleh->view);

        error———as show below

        olaccauh1.C
        olaccauh1.C(1105) : error C2224: left of ‘.flags’ must have struct/union type
        olaccauh1.C(1105) : warning C4047: ‘function’ : ‘A4W_FLAGS’ differs in levels of indirection from ‘void *’
        olaccauh1.C(1105) : warning C4024: ‘viewOldInstanceOpen’ : different types for formal and actual parameter 4
        olaccauh1.C(1105) : warning C4047: ‘function’ : ‘A4W_SIZE’ differs in levels of indirection from ‘LPV *’
        olaccauh1.C(1105) : warning C4024: ‘viewOldInstanceOpen’ : different types for formal and actual parameter 6
        olaccauh1.C(1105) : error C2198: ‘viewOldInstanceOpen’ : too few arguments for call

        manju

        November 4, 2015 at 12:33 pm

      • Its just saying there is no flags element in cmpNameList[CMP_OLACCAUH_OLORDLEH] (which is just a view composite name). Check rotoview.h for the flag values for this function.

        smist08

        November 4, 2015 at 11:00 pm

  41. Hi Smith,

    Thanks a lot for help, issue is resolved

    manju

    November 9, 2015 at 5:24 am

  42. Hi Smith,

    Thanks a lot for all your support and help for previous issues,

    MaxError(&e,lnkOpen(lpv->hpib, “DEVDAT”, FLG_READWRITE, &linkNo));

    I have logged in to SAMLTD ORGID, while calling lnkOpen how to get (LPByte) ORGID for DEVDAT which is another company.

    Pls help

    manju

    November 9, 2015 at 11:05 am

  43. Hi Smith,

    for below code when i try to run this function, run time Error say: Invalid Link

    I think there is problem on call of lnkOpen, bcoz ORGID should be in BYTES,

    I have logged in to SAMLTD ORGID, while calling lnkOpen how to get (LPByte) ORGID for DEVDAT which is another company.

    Pls help !!!
    ————————————————–
    static ERRNUM chkccon(LPV lpv)
    {
    ERRNUM e=ERRNUM_SUCCESS;
    LPVIEWDEF olordleh=FindCmp(lpv,CMP_OLACCAUH_OLORDLEH);
    char str[50];
    WORD linkNo;
    VIEWLOADSTRUCT vls;

    MaxError(&e,lnkOpen(lpv->hpib, “DEVDAT”, FLG_READWRITE, &linkNo));
    sprintf(str, “%d”, &linkNo);
    rvspyTrace(str);

    vls.iTag = 1;
    ibGetRoto (lpv->hpib, &vls.iRotoInstance);
    utlObjStrToID (“OL0102”, &vls.lViewID);
    strCopyBZ (vls.sPgmID, sizeof (vls.sPgmID), APPL);
    olordleh->rvh = viewLoadEx (&vls);

    rvspyTrace(“manju”);
    viewInstanceOpen(olordleh->rvh, lpv->hpib, linkNo, INSTANCE_OPEN_READWRITE, NULL, 0, &olordleh->view);
    MaxError(&e,viewInit(olordleh->rvh,olordleh->view));
    rvspyTrace(“manju2”);
    return e;
    }

    manju

    November 9, 2015 at 11:35 am

    • What you have there looks like it should work. Using “DEVDAT” for the field is fine. Check what the value of e is on return and compare it to the returned values in lnk.h and dbs.h to see what is wrong. Also you can try running DBSpy as it might give you a hint also.

      smist08

      November 9, 2015 at 9:56 pm

  44. Hi Smith,

    Thanks a lot for your reply,

    When i check On call of lnkOpen below code is not going towards success (==0),

    In Rvspy—-trace showing XYZ which says not success, Have i done wrong on call of lnkOpen else shall i try on call of DBlink,

    ———————————
    static ERRNUM chkccon(LPV lpv)
    {
    ERRNUM e=ERRNUM_SUCCESS;
    LPVIEWDEF olordleh=FindCmp(lpv,CMP_OLACCAUH_OLORDLEH);

    WORD linkNo;
    VIEWLOADSTRUCT vls;
    //——————————–
    if(lnkOpen(lpv->hpib, “DEVDAT”, FLG_READWRITE, &linkNo)==0)
    {
    rvspyTrace(“abc”);
    }
    else
    {
    rvspyTrace(“xyz”);
    }
    //———————————-

    vls.iTag = 1;
    ibGetRoto (lpv->hpib, &vls.iRotoInstance);
    utlObjStrToID (“OL0102”, &vls.lViewID);
    strCopyBZ (vls.sPgmID, sizeof (vls.sPgmID), APPL);
    olordleh->rvh = viewLoadEx (&vls);

    viewInstanceOpen(olordleh->rvh, lpv->hpib, linkNo, INSTANCE_OPEN_READWRITE, NULL, 0, &olordleh->view);
    MaxError(&e,lnkClose(linkNo));
    return e;
    }

    manju

    November 11, 2015 at 1:58 pm

  45. Hi Smith,

    Previous post continued…………..

    before calling lnkopen, do we have to call any other function to obtain link to another organization.

    pls correct me if i am wrong…

    manju

    November 11, 2015 at 3:49 pm

    • You shouldn’t. I think you need to find out the exact error number. If the error isn’t 0 then the number will tell you what is wrong, just check it against the include files. Running DBSpy will also probably tell you the error number to look up.

      smist08

      November 12, 2015 at 5:27 pm

  46. Hi Smith,

    Thanks a lot for all your reply and continues help,

    I have check with your above reply by running DBSPY it says DB NOT FOUND –error code 119,

    Previously mentioned code is working fine only if multi database linked to same sys database,
    for example:

    if orgid XYZDAT and orgid ABCDAT is linked to same DEFSYS database then it is working fine on call of lnkOpen,

    but in my situation XYZDAT is linked to XYZSYS AND
    ABCDAT is linked to ABCSYS,

    In this situation i want to access table from another database,

    Do i have to use lnkOpen or DBlink for above requirement, Pls correct me if i am wrong.

    Thanks
    Manju

    manju

    November 15, 2015 at 2:35 pm

    • Are you sure you can sign into this company using the desktop? It sounds like this company isn’t in your Database Setup?

      smist08

      November 16, 2015 at 5:24 pm

  47. Hi Smith,

    Thanks a lot for continues support provided,

    It is working fine now,

    When i linked same system database to multi DAT database then this issue is resolved.

    Request one clarification.

    if i share same SYS database for multi DAT database is there any collusion between DAT databases.If yes what are the scenarios pls let me know.

    Thanks
    Manju

    manju

    November 17, 2015 at 6:24 am

    • The main thing is that when companies share the same system they can synchronize their currency rates and security groups, saving you entering the same things into each of them.

      smist08

      November 17, 2015 at 7:16 pm

  48. Hi Smith,

    Thanks a lot for all your support on resolving this issue

    Once again thank u very much

    manju

    November 19, 2015 at 6:22 am

  49. […] repository, the code should look fairly familiar to anyone you has done any C# coding using our Sage 300 .Net API. Further this code should also appear somewhere in the matching VB code, and besides being […]

  50. Hi Stephen,

    Can I ask you one thing?

    I have two Sage 300 organizations. I can see licenses are correctly setup for both of them, but, for some reason, on the second one I cannot see most of the modules.

    Here is a screenshot of the second compnay:
    https://drive.google.com/file/d/0B0-AjXvuM7SMdldHY0d5M3ZsWTQ/view?usp=sharing

    Do you have any idea why it is happening?

    Thank you,

    Egidio

    Egidio Caprino

    July 13, 2016 at 9:23 am

    • Did you activate the modules for the second company in Admin Services – Data Activation? The desktop only shows the modules that have been activated for a company.

      smist08

      July 13, 2016 at 2:59 pm

  51. Hi stephen, I am trying to follow you tutorial, but I have an exception at session.Open

    The exception is :

    ACCPAC.Advantage.Server.Session dc40e687-a7f8-43ac-8ac9-8f36562639b5: Exception code -536870908

    And in the catch block when I print the exception message it gives me :

    Invalid Signon Information.
    Make sure you supply the correct User ID and Password.

    Although, I am pretty sure of the User ID and the Password because I am able to read from the database from Php code under a PDO connection using the same user ID and the same Password that I am using to open the session.

    Any tips?

    Julien Fadel

    August 11, 2016 at 5:30 pm

    • Stephen nevermind I just fixed it, the username and password had to be in CASPLOCK if someone else has the same problem.

      Julien Fadel

      August 11, 2016 at 6:16 pm

  52. Hi Stephen,

    I’m having a problem logging in from the API. With the same credentials, I can log in from the UI.

    Is there a way to enable/disable API access?

    Thank you,

    Egidio

    Egidio Caprino

    September 28, 2016 at 4:23 pm

    • Remember the API is case sensitive, so make sure you have them all in upper case. The only way to disable the API is to un-install it. You could always run the installer to ensure its installed.

      smist08

      September 28, 2016 at 4:48 pm

      • Thank you Stephen.

        Yes, I know that so I’m passing username, password and organization ID all in upper case.

        I cannot even print the organization IDs. When I try to fetch them, I get this Exception:

        Unhandled Exception: ACCPAC.Advantage.SessionException —> System.Runtime.InteropServices.COMException: Error HRESULT E
        _FAIL has been returned from a call to a COM component.
        at AccpacCOMSVR.AccpacSvrSessionClass.OrgsGetInfo(Int32& Count, Byte[]& Orgs)
        at ACCPAC.Advantage.Server.Session.OrgsGetInfo()
        — End of inner exception stack trace —
        at sage_300.Program.Main(String[] args)

        This happens on this portion of code:

        foreach (Organization org in sageSession.Organizations)
        {
        Console.WriteLine(“Company ID: ” + org.ID + ” Name: ” + org.Name + ” Type: ” + org.Type);
        }

        Do you have any idea?

        Thank you,

        Egidio

        Egidio Caprino

        September 28, 2016 at 9:01 pm

      • Not too sure. You could try running COM Spy on the Server Session to see if it tells you anything. If you have more than one version of Sage 300 installed, it could get confused as to which DLLs to load (make sure you don’t have multiple runtime folders in your path).

        smist08

        September 29, 2016 at 4:36 pm

      • Thank you Stephen.

        I managed by opening the session with these values:

        sageSession.Init(“”,”OE”,”OE0520”,”62A”);

        It is not clear for me what do they refers.

        Anyway, once I opened a session and logged in to an org, what if I want to switch and log to a different org? Do I simply have to open the new db link? I don’t see any method for closing the previously opened link.

        Thank you,

        Egidio

        Egidio Caprino

        October 13, 2016 at 10:03 am

      • Use session.clone to get a session for another company.

        smist08

        October 13, 2016 at 3:07 pm

      • Thank you Stephen!

        After I cloned the session I have to open a new db link, right?

        Thanks,

        Egidio

        Egidio Caprino

        October 14, 2016 at 11:27 am

      • Yes.

        smist08

        October 14, 2016 at 9:27 pm

  53. Hi Stephen,

    How do we close the Sage session and the db link?

    Thank you,

    Egidio

    Egidio Caprino

    October 26, 2016 at 2:02 pm

    • If there isn’t an explicit close method then it will be closed in its destructor. Setting the object to null will cause it to get cleaned up by the garbage collector. If you really need it done right now, you can call System.GC.Collect();

      smist08

      October 26, 2016 at 3:18 pm

  54. Hi Stephen,

    I’ve tried the code you provided….
    But no matter what I do I get “Invalid Signon Information.Make sure you supply the correct User ID and Password.” error.

    I know that I’m providing the correct username and password since it works in using sage 300.
    I know I’m providing the correct company ID since I can see it in the org loop.
    If you’ve encountered a similar problem and have a solution, Please share. Thanks

    Boris

    November 7, 2016 at 8:41 pm

    • Note that this info is case sensitive in the API, so since the UI uppercases these, you have to provide them in upper case to the API.

      smist08

      November 7, 2016 at 9:34 pm

      • I passed the username in uppercase… I’ve tried passing the password in uppercase and the lowercase. Still getting “Invalid Signon Information.Make sure you supply the correct User ID and Password.”

        Boris

        November 7, 2016 at 9:39 pm

  55. Hi Stephen,

    I have an error being thrown at session.Init(“”, “XX”, “XX1000”, “62A”);

    The error is as follows:
    ACCPAC.Advantage.SessionException —> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xFFFFFFFE\\r\\n
    at AccpacCOMSVR.AccpacSvrSessionClass.InitEx2(String directory, Int32 Key, String ObjectHandle, String AppID, String ProgramName, String AppVersion, String ClientID, Boolean CheckStatus, Int32 behavior, Boolean& IsOpened, Byte[]& SessionInfo)\\r\\n
    at ACCPAC.Advantage.Server.Session.InitEx2(String directory, Int32 key, String objectHandle, String appID, String pgmName, String appVersion, String clientID, Boolean checkStatus, Int32 behavior)\\r\\n
    — End of inner exception stack trace —\\r\\n
    at ACCPAC.Advantage.Server.Session.InitEx2(String directory, Int32 key, String objectHandle, String appID, String pgmName, String appVersion, String clientID, Boolean checkStatus, Int32 behavior)\\r\\n
    at ACCPAC.Advantage.Session.InitEx2(String directory, String objectHandle, String appID, String programName, String appVersion, Int32 behavior)\\r\\n

    Rohith

    November 9, 2016 at 3:42 am

    • Can you please help me?

      Rohith

      November 9, 2016 at 3:43 am

    • Perhaps try running the accpac\runtime\regacc.exe program. Also try running a macro, make sure those are working. Do you have multiple versions of Sage 300 installed? This can cause problems of this nature.

      smist08

      November 9, 2016 at 6:31 pm

      • Hi Stephen,

        I’m having some troubles updating some fields in the Customer view.

        I set them with the verify flag equals to true, then I also call the verify method. When I call the update I got no error but from the UI the fields have not been updated.

        Do you have any clue?

        Thanks,

        Egidio

        Egidio Caprino

        November 16, 2016 at 9:28 am

  56. Hi Stephen, was wondering if you are open to freelancing and help us get the api working?

    Boris

    November 9, 2016 at 3:58 pm

    • Sorry, but I’m doing other things these days. I’m sure another Sage 300 business partner or development partner could help you.

      smist08

      November 9, 2016 at 6:33 pm

  57. Hi Stephen,

    I’m getting a strange error while updating some fields in the Customer view.

    I’m setting the value with the verify flag set to true and I get no error. I also call the verify method and I get no error. I call the update method and I get no error but in the UI the fields are not updated.

    Do you have any idea why is it happening?

    Thanks,

    Egidio

    Egidio Caprino

    November 16, 2016 at 10:24 am

    • If the fields are actually in a detail view then you need to update the detail, then update ARCUS to commit the changes to the database. Also ensure you read the correct record before updating it.

      smist08

      November 16, 2016 at 8:28 pm

      • Thank you Stephen. Is ARCUS the header view? I’m updating that one.

        Egidio Caprino

        November 17, 2016 at 7:52 am

  58. Hi Stephen

    I have successfully implemented the API using Sage 300 2016. One of my implementations now fails on Sage 300 2014 with the following error: HRESULT E_FAIL has been returned from a call to a COM component.

    Can this be due to the older version of Sage 300 ? Are the methods calls in the API backwards compatible ?

    Hope you have a great 2017 !

    Kind regards

    Jaco

    Jaco Visagé

    January 3, 2017 at 7:45 am

    • They mostly are compatible, as are the views. I suspect you need to run your program in the debugger to see what line it failed on. A common cause is a client not having an expected module activated or some other data difference (perhaps being multi-currency or something).

      smist08

      January 3, 2017 at 6:46 pm

      • Thank you Stephen

        Jaco Visagé

        January 4, 2017 at 7:01 am

  59. Hi, dont know if this will still work but let me try. If I want to dev, how do I connect to the MSSQL db without having Sage300 installed on the machine running the program? the program will pull invoices and write orders into the Sage DB. But nowhere can I see where I open a connection to the DB on another server? The actual connection string? How do I tell the AccPac.Advantage where the DB is in the Cloud?

    Dewald

    January 6, 2017 at 2:08 pm

    • To write data into the Sage 300 database, you need to use the Sage 300 business logic to do this. So you must have at least workstation setup run on that machine. If you write data into the database using something like ODBC then you will likely corrupt the database and cause all sorts of problems down the road. For reporting purposes you can read data directly via ODBC, but not to write data. You must use the API to add your invoices and orders into the system.

      smist08

      January 6, 2017 at 4:59 pm

  60. Hi Stephen,
    An unhandled exception of type ‘System.AccessViolationException’ occurred in Unknown Module.

    Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

    I get this error when i am trying to open the session. Its the same code as you open the session in samples only change is userid, password and companyid. All are in caps as i see its case sensitive..

    Is this error of .net or something related with sage dlls connection issue while integrating.
    Much appreciated your help!!

    Arpit

    February 12, 2017 at 8:46 pm

    • Any word on this Stephen?

      Arpit

      February 19, 2017 at 8:50 pm

      • Don’t know what it would be. It could be you multiple installations of Sage 300? I suspect some sort of DLL conflict problem.

        smist08

        February 19, 2017 at 9:42 pm

      • I took your sample ARInvEntry from google drive. Just changed the login credentials for session and company id. And i am getting this error. Is there anything else i need to change, if i missed something that cause this issue.

        Arpit

        February 19, 2017 at 9:49 pm

    • I get this error when trying to use FilterFetch. Any ideas on the cause?

      John

      November 4, 2021 at 6:52 am

  61. Hi Stephen,
    I am new with Sage Integration. Can you tell me that from where i can find the parameters for method session.Init(“”,””,””,””);
    from where i can get the AppID, Program Name, and Appversion?

    Thanks

    Amit Sharma

    February 22, 2017 at 1:39 am

    • Hi Stephen,
      I have got the AppId and Program Name.
      But i am getting an error when i am trying to open a session using credentials.

      Invalid Signon Information.

      Make sure you supply the correct User ID and Password.

      can you please help me out.

      With the same credentials i am able to open AccPac ERP.

      Thanks

      Amit Sharma

      February 22, 2017 at 2:45 am

      • Hi Amit, Try to send your password in caps..

        Arpit

        February 23, 2017 at 5:30 pm

  62. Hi Stephen,
    Its done by passing passwords in CAPS.
    Can you please check my comment in “https://smist08.wordpress.com/2013/10/27/composing-views-in-the-sage-300-erp-net-api/”

    I have a query regarding order details integration.

    Thanks

    Amit Sharma

    March 1, 2017 at 5:03 am

  63. HI,I Want to drag OE1100.ocx to winform ,but it popup message,Failed to import ActiveX control. Make sure it is properly registered.how ?

    Oscar Salazar

    March 29, 2017 at 12:17 am

  64. I’m a newbie to Sage. Quick question, how do I log into a Sage 300 system across a local network?

    nguy1

    June 14, 2017 at 12:00 am

    • Typically you would do a full install on the server, and then run the workstation setup installation on each computer you wanted to use on the LAN. This will set everything up so you can log in.

      smist08

      June 14, 2017 at 8:21 pm

  65. Very new to Sage 300, need a few inputs. We’re currently in the process of integration Sage300 with Dynamics CRM. We have an instance on Sage 300 running on AWS.

    1. What are a few things, I need to put into the consideration before getting started.
    2. Do I need to have a Database instance for the integration to happen between CRM and Sage 300.

    Any suggestion will help.

    Suleiman Ali

    September 28, 2017 at 9:22 pm

    • If you are writing data into Sage 300 then you need to use an API such as the .Net API. If you are just reading data then you could consider just going to the database directly. You don’t need a separate database instance, usually things work faster without one, until you reach a certain number of users then it helps. There are some 3rd party integrations such as from Starfish or eBridge. It largely depends on what you are trying to do.

      smist08

      September 29, 2017 at 8:08 pm

  66. i USE SAGE 300 ERP. Some days ago suddenly my .net project given this error.but earlier i can easily push data in sage. Please Help

    Invalid Signon Information.

    Make sure you supply the correct User ID and Password.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Invalid Signon Information.

    Make sure you supply the correct User ID and Password.

    Ummay Afroza

    November 27, 2017 at 10:16 am

    • The error sounds pretty specific. Did someone change a password on you? Perhaps the account is disabled for some reason? Did you try logging on to the desktop using the same credentials?

      smist08

      November 27, 2017 at 6:22 pm

      • yah.I try to logging on the desktop using same id and password.This worked perfectly.Also change my password .After changing my password desktop logging also worked perfectly, but couldn’t do with this error 😦

        Ummay Afroza

        November 28, 2017 at 4:05 am

      • I think you’ll have to use COM Spy to spy on the various COM objects to see what is really failing and perhaps get a clue as to why. Also you could try using regacc.exe to unregister all the Sage 300 COM objects and the re-register them, that sometimes fixes things up.

        smist08

        November 28, 2017 at 7:48 pm

  67. Hi Stephen,
    How to use COM spy?? I don’t know about this.Can you help me please???

    Ummay Afroza

    December 3, 2017 at 11:40 am

  68. Hi Stephen,

    What causes dbslink.c – 1274 – no free links

    we using Accpac 6.2

    Lolo

    February 7, 2018 at 2:24 pm

    • There is a limit to the number of dblinks (perhaps 256, I don’t remember). When these run out you get this message. Usually this means you have a leak in your program, you are opening links without closing them.

      smist08

      February 9, 2018 at 9:25 pm

  69. Hi,
    In .net there is GetSchema() method on DbConnection, to get tables, columns, primary keys and many other schema info for the selected connection. Now I need to get it all connecting to Sage300CRE database also. Using the Api, is it possible to get all these Schema information?

    Nishitha

    February 9, 2018 at 11:44 am

    • My experience was with Sage 300 ERP (formally Accpac). I don’t really know much about CRE (formally Timberline). Sorry.

      smist08

      February 9, 2018 at 9:26 pm

  70. hi, new to accpac integration , zero knowledge looking for a starting point…i have accpac installed..have a asp.net application server that can link up to the database to read data and generate reports, but since we have to use the API to create orders and write to the accpac…do i just use the command “using ACCPAC.Advantage;” on my asp codes or i have to somehow set it up so that the asp server can recognize the command? hope you can point me to the right direction ..thanks

    ken

    July 1, 2018 at 1:47 am

    • You can download the code associated with these articles. Have a look at these.

      smist08

      July 1, 2018 at 1:53 am

  71. […] Smith introduces .NET API on his […]

  72. Hi Stephen,

    Thank for the wonder full information.

    I am new to Sage 300 integration as well. Is there document covering ACCPAC.Advantage C# syntax or commands needed to integrate with accpac tables. Few are mentioned in you beautiful presentation.

    But is there comprehensive document?

    Thanks in advance!

    Fawmy Fazlan

    December 21, 2018 at 2:25 am

    • Hi Stephen,

      I found all the info needed in your shared materials.

      But i can find the advance dll ‘s in the run time folder for referencing?? .net libraries were installed?

      Your help is needed? 🙂

      Fawmy Fazlan

      December 25, 2018 at 7:31 am

      • Sage 6.0 erp 300 (PU 1 )

        .net libraries are installed.

        Fawmy Fazlan

        December 25, 2018 at 7:32 am

  73. Hello, I have a question as follow: I have developped a C# web application which is working fine on the server side but, when i connect using the application link from another pc, I am unable to open accpac session although the client PC is running Accpac normally on their local machine. Please advise on what could possiblybe the problem.

    Thank you…

    Damaz Alexis

    April 4, 2019 at 7:15 pm

    • I AM facing issue while using .net api in sage300 2017 windows based “throwing error accpac reference missing in assemblies..Although it working fine in sag300 6.1 version…Also i noticed in sag300 2017 windows based Sage 300 ERP .Net Libraries not registering in GAC…
      “. Can we use .net api in sage300 2017 windows base as well all workstation copy of server side ..

      YOGESH

      January 4, 2021 at 6:52 pm

  74. Any reason Advantage DLL requires Windows.Forms DLL? Seems an odd requirement. I’m trying to use a console app. My first time using the API

    John

    September 29, 2021 at 7:23 am


Leave a reply to Amit Sharma Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.