[Event Request] Codeunit 10750 "SII XML Creator" - OnAfterGenerateXmlDocument
Hi,
We need a new event in codeunit 10750 "SII XML Creator" at "GenerateXML" procedure. It should be simiilar to the existing OnBeforeGenerateXMLDocument. The new event and the modified procedure should be like the following (there is no DotNet in the new event, this is why the procedure should also be modified)
OnAfterGenerateXmlDocument(LedgerEntry: Variant; var XMLDocOut: XmlDocument; UploadType: Option; IsCreditMemoRemoval: Boolean; var ResultValue: Boolean; var IsHandled: Boolean; RetryAccepted: Boolean; SIIVersion: Option)
procedure GenerateXml(LedgerEntry: Variant; var XMLDocOut: DotNet XmlDocument; UploadType: Option; IsCreditMemoRemoval: Boolean): Boolean
var
CustLedgerEntry: Record "Cust. Ledger Entry";
VendorLedgerEntry: Record "Vendor Ledger Entry";
DetailedCustLedgEntry: Record "Detailed Cust. Ledg. Entry";
DetailedVendorLedgEntry: Record "Detailed Vendor Ledg. Entry";
XmlDocTempBlob: Codeunit "Temp Blob";
RecRef: RecordRef;
XmlDocumentOut: XmlDocument;
XmlDocOutStream: OutStream;
XmlDocInStream: InStream;
IsHandled: Boolean;
ResultValue: Boolean;
begin
...
DATABASE::"Detailed Vendor Ledg. Entry":
begin
RecRef.SetTable(DetailedVendorLedgEntry);
if not (DetailedVendorLedgEntry."Document Type" in
[DetailedVendorLedgEntry."Document Type"::Payment, DetailedVendorLedgEntry."Document Type"::Refund])
then
ErrorMsg := StrSubstNo(DetailedLedgerEntryShouldBePaymentOrRefundErr, Format(DetailedVendorLedgEntry."Document Type"));
VendorLedgerEntry.Get(DetailedVendorLedgEntry."Vendor Ledger Entry No.");
exit(CreateEmittedPaymentsXml(VendorLedgerEntry, XMLDocOut))
end
else
exit;
end;
//New Event
//First, transform from DotNet XmlDocument to AL XMLDocument
XmlDocTempBlob.CreateOutStream(XmlDocOutStream);
XMLDocOut.Save(XmlDocOutStream);
XmlDocTempBlob.CreateInStream(XmlDocInStream);
XmlDocument.ReadFrom(XmlDocInStream, XMLDocumentOut);
OnAfterGenerateXmlDocument(LedgerEntry, XmlDocumentOut, UploadType, IsCreditMemoRemoval, ResultValue, IsHandled, RetryAccepted, SIIVersion);
if IsHandled then begin
XmlDocTempBlob.CreateOutStream(XmlDocOutStream);
XmlDocumentOut.WriteTo(XmlDocOutStream);
XmlDocTempBlob.CreateInStream(XmlDocInStream);
XMLDocOut.Load(XmlDocInStream);
end;
//END New Event
Thanks.
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.
@amunoz-ldr Como usas el OnAfterGenerateXmlDocument? Cuando el código llega al case, todos los casos del case tienen un exit, por lo que OnAfterGenerateXmlDocument no se ejecuta :/
@deadmouse Si, tal como lo han implementado no sirve para nada. Crearé otra solicitud para pedir que cambien los exit por ResultValue := Create....
@amunoz-ldr Abrí un ticket y lo han arreglado en la 21.0.46256.48144.
