[Request-For-External] Codeunit 80 "Sales-Post" - Procedure from Internal to Global
Describe the request
Hello, we need the following currently local procedure to be set to global. Can you please check this? Thank you!
procedure PostUpdateReturnReceiptLine()
local procedure PostUpdateInvoiceLine(var SalesHeader: Record "Sales Header")
Additional context
Post a Invoice with Return Receipts Internal work item: AB#523913
@MH1612 both the methods seem to depend on one or more global variables to be set, making those methods as public increases the risk of those methods failing or returning undesired results. Can you please explain the use case for better understanding?
Hi,
I will answer for my colleague. We have build a process to Post an Invoice connected to a Return Receipt (and also a Credit Memo connected to Sales Shipments). For that it is neccessarry to the call to procedure out of COD80-Events (out of existing Events where the sender is also accessable)
In my opinion the procedure doesn't use global variables (only text labels). The similar procedures in COD90 (PostUpdateInvoiceLine, PostUpdateCreditMemoLine) are already set to global.
Both these methods use global variable TempSalesLineGlobal. How do you plan to set it up before calling this method?
local procedure PostUpdateReturnReceiptLine() var SalesOrderLine: Record "Sales Line"; ReturnRcptLine: Record "Return Receipt Line"; TempSalesLine: Record "Sales Line" temporary; IsHandled: Boolean; begin IsHandled := false; OnBeforePostUpdateReturnReceiptLine(TempSalesLineGlobal, IsHandled); if IsHandled then exit; .... .... end; local procedure PostUpdateInvoiceLine(var SalesHeader: Record "Sales Header") var SalesOrderLine: Record "Sales Line"; SalesShptLine: Record "Sales Shipment Line"; TempSalesLine: Record "Sales Line" temporary; TempSalesOrderHeader: Record "Sales Header" temporary; CRMSalesDocumentPostingMgt: Codeunit "CRM Sales Document Posting Mgt"; IsHandled: Boolean; begin IsHandled := false; OnBeforePostUpdateInvoiceLine(TempSalesLineGlobal, IsHandled); if IsHandled then exit; ... ... end;
Hi,
we want to call the functions in context of codeunit 80 out of an Event Subscriber with has the Include-Sender-Property set (so the global variables are also available). The global variable is also only used in the Event Publisher, not in the "normal" procedure source code.
@SKeiler, codeunit 80 does not seem to have any IntegrationEvent where both 'IncludeSender' and 'GlobalVarAccess' is set to true. Is there a different ask for that?
Hi @ChethanT: It's enough if IncludeSender is true. Then you could call the procedure out of an EventSubscriber for the Sender-Parameter and the existing global variables are existing in the Instance of the Sales-Post-Codeunit.
Hi @ChethanT: It's enough if IncludeSender is true. Then you could call the procedure out of an EventSubscriber for the Sender-Parameter and the existing global variables are existing in the Instance of the Sales-Post-Codeunit.
Ahh, thats what you mean. Thanks for the clarification
Processed for Wave 2 2024.
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: 19857.