-
Notifications
You must be signed in to change notification settings - Fork 692
[Bug]: [DE] ZUGFeRD export misses Seller Order Reference (BT-14) and lacks extensibility event in InsertApplicableHeaderTradeAgreement #29892
Description
Describe the issue
The ZUGFeRD XML export (codeunit 13917 "Export ZUGFeRD Document") does not include the seller’s internal sales order reference when it is available on the posted sales document header.
In Business Central, Sales Invoice Header."Order No." contains the seller’s internal Sales Order No. (invoice created from order). This corresponds to BT-14 (Seller order reference) in EN 16931.
In ZUGFeRD / Factur-X (CII), this reference should be represented using ram:SellerOrderReferencedDocument, but it is currently missing from the generated XML.
Additionally, there is no integration event at the end of InsertApplicableHeaderTradeAgreement(...) to allow partners to extend the header trade agreement node before it is attached to the XML tree (e.g., to add ram:ContractReferencedDocument).
Expected behavior
-
If
Order No.is populated on the posted document header, the ZUGFeRD export should include BT-14 viaram:SellerOrderReferencedDocument(following the ZUGFeRD mapping). -
If
Order No.is empty, omit the element (no change). -
Add an IntegrationEvent to allow extensions to modify/extend the
ApplicableHeaderTradeAgreementnode before it is added:[IntegrationEvent(false, false)] local procedure OnAfterInsertApplicableHeaderTradeAgreement( var HeaderTradeAgreementElement: XmlElement; HeaderRecordRef: RecordRef) begin end;
Example call placement:
OnAfterInsertApplicableHeaderTradeAgreement(HeaderTradeAgreementElement, HeaderRecordRef); RootXMLNode.Add(HeaderTradeAgreementElement);
Steps to reproduce
- Create a Sales Order and post an invoice created from that order (so
"Order No."is populated on the posted Sales Invoice). - Export the posted document as ZUGFeRD.
- Inspect the XML near
ram:ApplicableHeaderTradeAgreement. - Observe that
ram:SellerOrderReferencedDocument(BT-14) is missing.
Additional context
- Business term: BT-14 Seller order reference (seller’s internal order identifier).
- Event request enables partner scenarios like adding
ram:ContractReferencedDocumentfor contract numbers.
I will provide a fix for a bug
- I will provide a fix for a bug