Hougaard.com – Applied Hacking

Additional Grouping Identifier

This is one of those blog posts that might mostly be for the hive mind and Googling.

When posting an invoice, Business Central will aggregate the sales G/L post based on identifiers. So if two sales lines generates the same G/L sales post, it will just be aggregated into one G/L Journal Line (and one G/L Ledger Entry)

In some cases, we’ll want to suspress that behavoir and in the old days, that would be a change to table 49, but now Microsoft have added a new field:

The Additional Grouping Identifier

The Additional Group Identifier is just a simple field, but part of the primary key, so if we add a unique value to that field, we’ll have disabled the aggregation.

Thankfully, there’s also an Event on table 49 we can subscribe to, called OnAfterInvPostBufferPrepareSales.

codeunit 50107 "Demo - Sales Buffer"
                     Database::"Invoice Post. Buffer", 
                     '', true, true)]
    procedure MakeBufferUnique(var InvoicePostBuffer: 
                               Record "Invoice Post. Buffer";
                               var SalesLine: 
                               Record "Sales Line")
        // Use Sales Line line number to make buffer unique
        InvoicePostBuffer."Additional Grouping Identifier" := 
            format(SalesLine."Line No.", 0, 2);

What we’re doing is simple: Use the line number from the sales line as the Additional Group Identifier. This results in no aggregation in the G/L at all – Mission Completed!

Print Friendly, PDF & Email

1 thought on “Additional Grouping Identifier

Leave a Reply

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