How to Post the AR or AP Batch using Accpac Advantage.


Hi all, I have already created C# program using Accpac Advantage to import AR and AP Batches into sage in Ready to Post Mode. But my client wants it to auto post after import to sage. So, is there any tutorial or example that I can reference for doing this since I am quite new in this area? Thank you for your help and guidance in advance!

  • 0

    Are you using the .NET API, COM API, or the web API?

  • 0 in reply to Vega

    I am Using accpac advantage dll to open the view and import. But any reference would be fine. I just want to know how to post the batches in C# using this dll.


  • 0 in reply to Hein Thu

    The easiest way to work this out is to record a macro where you create a new batch, add an invoice, and then post it. Then take the macro code and convert it to C#.

    The code to post an AR batch is here though:

            private bool PostARInvoiceBatch(out string psError)
                // oARIBC = AR0031
                // oARPostInv = AR0048
                bool bSuccess = false;
                psError = "";
                if (mbDebugMode) { HandleLogRequest($"In {MethodBase.GetCurrentMethod().Name}"); }
                    oARIBC.Fields.FieldByName("PROCESSCMD").SetValue("2", false);
                    oARIBC.Fields.FieldByName("BTCHSTTS").SetValue("7", true);
                    oARIBC.Fields.FieldByName("PROCESSCMD").SetValue("0", false);
                    oARPostInv.Fields.FieldByName("BATCHIDFR").SetValue(oARIBC.Fields.FieldByName("CNTBTCH").Value.ToString().Trim(), false);
                    oARPostInv.Fields.FieldByName("BATCHIDTO").SetValue(oARIBC.Fields.FieldByName("CNTBTCH").Value.ToString().Trim(), false);
                    bSuccess = true;
                catch (Exception ex)
                    psError = $"There was a problem posting AR invoice batch: '{ex.Message + Environment.NewLine + WriteSageErrorsToLog()}'";
                return bSuccess;

    I have added comments telling you which views these are. You will need to know how to compose the views.