19

Suggested by Christian Mütze Under Review 

Hi We ran into a performance issue with a recently upgraded customer. It turned out that it was caused from the Sales Shipment Buffer buildup routine as there were many Sales Invoice lines in the system with a G/L account on. This can be fixed quite easy with a small code modification. The result is a much better performing system. Hope that this is a OK place to place this suggestion. As I can't attach files, I'll copy & paste the code suggestion in here. OBJECT Table 7190 Sales Shipment Buffer GenerateBufferFromShipment(); BEGIN TotalQuantity := 0; // Change This SalesShipmentLine.SETRANGE("Order No.",SalesInvoiceHeader2."Order No."); SalesShipmentLine.SETRANGE("Order Line No.",SalesInvoiceLine2."Line No."); SalesShipmentLine.SETRANGE("Line No.",SalesInvoiceLine2."Line No."); SalesShipmentLine.SETRANGE(Type,SalesInvoiceLine2.Type); SalesShipmentLine.SETRANGE("No.",SalesInvoiceLine2."No."); SalesShipmentLine.SETRANGE("Unit of Measure Code",SalesInvoiceLine2."Unit of Measure Code"); SalesShipmentLine.SETFILTER(Quantity,'<>%1',0); IF SalesShipmentLine.ISEMPTY THEN EXIT; // Change This SalesInvoiceHeader.SETFILTER("No.",'..%1',SalesInvoiceHeader2."No."); --- GenerateBufferFromReceipt(); BEGIN IF SalesCrMemoHeader."Return Order No." = '' THEN EXIT; TotalQuantity := 0; // Change This ReturnReceiptLine.SETCURRENTKEY("Return Order No.","Return Order Line No."); ReturnReceiptLine.SETRANGE("Return Order No.",SalesCrMemoHeader."Return Order No."); ReturnReceiptLine.SETRANGE("Return Order Line No.",SalesCrMemoLine."Line No."); ReturnReceiptLine.SETRANGE("Line No.",SalesCrMemoLine."Line No."); ReturnReceiptLine.SETRANGE(Type,SalesCrMemoLine.Type); ReturnReceiptLine.SETRANGE("No.",SalesCrMemoLine."No."); ReturnReceiptLine.SETRANGE("Unit of Measure Code",SalesCrMemoLine."Unit of Measure Code"); ReturnReceiptLine.SETFILTER(Quantity,'<>%1',0); IF ReturnReceiptLine.ISEMPTY THEN EXIT; // Change This SalesCrMemoHeader2.SETCURRENTKEY("Return Order No."); // CM

Status Details

Thank you for your feedback. We are considering adding it to our longer term roadmap. 

Your help is greatly appreciated, 
Business Central Team
Comments (3)
  • We fixed this by a table that creates a direct reference from invoice line to shipment line on document posting. And if i unterstand this code snippet correctly, there is also a problem if orderlines are invoiced partialy, because you cant differentiate which invoice invoiced which shipmentline with which quantity.
  • Additional comment: if this is a combine shipment invoice, line numbers in invoice and shipment may differ.
  • I think this is a block of code we have need to disable historically in our Navision 5 database for performance reasons... I hope MS fix this soon.