Parent line must refer to an existing invoice line

Error BR-FXEXT-11 Factur-X

Each "ID of parent line" (BT-X-304) must refer to an existing "ID of invoice item" (BT-126).

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

The value in ram:ParentLineID does not match any invoice line’s ram:LineID. As a result, the specified parent line does not refer to an existing invoice line.

What the rule means

The parent line identifier establishes a relationship between invoice lines. It must identify an existing invoice line so that the relationship can be resolved.

Affected fields BT-X-304 BT-126
Please link `ram:ParentLineID` to an existing invoice line

The specified parent line was not found among the invoice lines. You can correct the link by using an existing line identifier.

What to do
  1. Find the relevant ram:ParentLineID in the invoice line.
  2. Check the related ram:LineID and ram:ParentLineID in AssociatedDocument.
  3. Check the call to SetParentLineId(...).
  4. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:IncludedSupplyChainTradeLineItem>
  <ram:AssociatedDocumentLineDocument>
    <ram:LineID>10</ram:LineID>
    <ram:ParentLineID>99</ram:ParentLineID>
  </ram:AssociatedDocumentLineDocument>
</ram:IncludedSupplyChainTradeLineItem>
✓ Correct
<ram:IncludedSupplyChainTradeLineItem>
  <ram:AssociatedDocumentLineDocument>
    <ram:LineID>10</ram:LineID>
  </ram:AssociatedDocumentLineDocument>
</ram:IncludedSupplyChainTradeLineItem>
<ram:IncludedSupplyChainTradeLineItem>
  <ram:AssociatedDocumentLineDocument>
    <ram:LineID>20</ram:LineID>
    <ram:ParentLineID>10</ram:ParentLineID>
  </ram:AssociatedDocumentLineDocument>
</ram:IncludedSupplyChainTradeLineItem>
Check in FactoorSharp
  • AssociatedDocument.LineID (BT-126)
  • TradeLineItem.AssociatedDocument (BT-126)
  • AssociatedDocument.ParentLineID (BT-X-304)
  • TradeLineItem.SetParentLineId(parentLineId) (BT-X-304)
Technical details

The test compares the normalized value of ram:ParentLineID with the normalized values of all ram:LineID elements under ram:IncludedSupplyChainTradeLineItem.

Where the rule applies

The rule applies to ram:IncludedSupplyChainTradeLineItem when it contains a ram:ParentLineID. That value must match a ram:LineID of an invoice line.

Context (rule/@context)
//ram:IncludedSupplyChainTradeLineItem [normalize-space(ram:AssociatedDocumentLineDocument/ ram:ParentLineID) != '']
Test expression (assert/@test)
some $p in //ram:IncludedSupplyChainTradeLineItem/ram:AssociatedDocumentLineDocument/ ram:LineID satisfies normalize-space($p) = normalize-space(ram:AssociatedDocumentLineDocument/ ram:ParentLineID)