Posting AR or AP Batches using accpac advantage

SUGGESTED

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

    In general, when you're trying to figure out how to automate something in Sage 300, you can record a macro of the process. That will generate VBA code for you that you can then generalize and translate into the language that you're using.

    For posting batches there are a couple of ways. One is to open the Post Batches view and pass it the batch numbers. In the case below, AR0048 is the Post Invoices view.

        Dim PostBatchView As AccpacCOMAPI.AccpacView
        fDBLink.OpenView "AR0048", PostBatchView

        PostBatchView.Fields("BATCHIDFR").PutWithoutVerification BatchNumber
        PostBatchView.Fields("BATCHIDTO").PutWithoutVerification BatchNumber

        PostBatchView.Process

    In this example, I'm trying to lock access to the AR receipt batch before setting the status to Ready to Post. Then I call the Receipt posting view.

        With ReceiptBatch
            .Fields("PROCESSCMD").PutWithoutVerification ("3")    ' Process Command
            .Process
            .Fields("BATCHSTAT").value = "7"                      ' Batch Status
            .Update
            .Fields("PROCESSCMD").PutWithoutVerification ("1")    ' Process Command
            .Process
        End With

        Dim ARReceiptPost As AccpacCOMAPI.AccpacView
        fDBLink.OpenView "AR0049", ARReceiptPost

        ARReceiptPost.Fields("BATCHIDFR").PutWithoutVerification BatchNumber
        ARReceiptPost.Fields("BATCHIDTO").PutWithoutVerification BatchNumber

        ARReceiptPost.Process