[Event Request] Codeunit 80 "Sales-Post" - Shipment and Order Numbers
Why do you need this change?
We would like to request new integration events in the Sales-Post codeunit, which checks for shipments and order numbers. As this check is executed for every line being posted, the overhead for bulk operations is incredibly high, even though the functionality is not in use by any of our customers. To improve performance during our bulk posting operations, the events will be subscribed using manual subscription to skip these costly executions for each line.
Describe the request
Object: codeunit 80 "Sales-Post" Procedure: SetInvoiceOrderNo
Code:
#if NEWEVENTS
[IntegrationEvent(false, false)]
local procedure OnBeforeSetInvoiceOrderNo(SalesLine: Record "Sales Line"; var SalesInvLine: Record "Sales Invoice Line"; var IsHandled: Boolean)
begin
end;
#endif
local procedure SetInvoiceOrderNo(SalesLine: Record "Sales Line"; var SalesInvLine: Record "Sales Invoice Line")
var
SalesShptLine: Record "Sales Shipment Line";
#if NEWEVENTS
IsHandled: Boolean;
begin
OnBeforeSetInvoiceOrderNo(SalesLine, SalesInvLine, IsHandled);
if IsHandled then
exit;
#else
begin
#endif
if SalesLine."Document Type" = SalesLine."Document Type"::Order then begin
SalesInvLine."Order No." := SalesLine."Document No.";
SalesInvLine."Order Line No." := SalesLine."Line No.";
end else
if SalesShptLine.Get(SalesLine."Shipment No.", SalesLine."Shipment Line No.") then begin
SalesInvLine."Order No." := SalesShptLine."Order No.";
SalesInvLine."Order Line No." := SalesShptLine."Order Line No.";
end;
end;
Object: codeunit 80 "Sales-Post" Procedure: PostUpdateOrderNo
Code:
#if NEWEVENTS
[IntegrationEvent(false, false)]
local procedure OnBeforePostUpdateOrderNo(var SalesInvoiceHeader: Record "Sales Invoice Header"; var IsHandled: Boolean)
begin
end;
#endif
local procedure PostUpdateOrderNo(var SalesInvoiceHeader: Record "Sales Invoice Header")
var
SalesInvoiceLine: Record "Sales Invoice Line";
#if NEWEVENTS
IsHandled: Boolean;
begin
OnBeforePostUpdateOrderNo(SalesInvoiceHeader, IsHandled);
if IsHandled then
exit;
#endif
if SalesInvoiceHeader."No." = '' then
exit;
...
end;
Internal work item: AB#610441
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Build ID: 41916.