Use an absolute URL for the external document reference

Error BR-TMP-2 XRechnung

BT-124 "External document location" shall contain an absolute URL with a valid scheme.

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

If ram:URIID is present, its value must be an absolute URL with a valid scheme. A relative value or one that does not match the expected URL format violates this rule.

What the rule means

BT-124 contains the external location of the additional supporting document. An absolute URL with a valid scheme identifies that location as a web address.

Affected fields BT-124
Please provide an absolute URL for the external document

The external document reference contains a URL that does not match the expected format. You can correct the reference or omit it if no external location is being provided.

What to do
  1. Correct ram:URIID to an absolute URL with a valid scheme, or omit ram:URIID.
  2. Check the value for AdditionalReferencedDocument.URIID or the uriID parameter in the call to AddAdditionalReferencedDocument(...).
  3. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>916</ram:TypeCode>
  <ram:URIID>documents/file.pdf</ram:URIID>
</ram:AdditionalReferencedDocument>
✓ Correct
<ram:AdditionalReferencedDocument>
  <ram:TypeCode>916</ram:TypeCode>
  <ram:URIID>https://example.com/documents/file.pdf</ram:URIID>
</ram:AdditionalReferencedDocument>
Check in FactoorSharp
  • AdditionalReferencedDocument.URIID (BT-124)
  • FacturXInvoice.AddAdditionalReferencedDocument(id, typeCode, issueDateTime, name, referenceTypeCode, attachmentBinaryObject, filename, uriID) (uriID: BT-124)
Technical details

The test permits ram:URIID to be absent or requires its value to match $XR-URL-REGEX.

Where the rule applies

The reference to an additional referenced document with ram:TypeCode 916 in ram:AdditionalReferencedDocument.

Original message from the Schematron
BT-124 "External document location" muss eine absolute URL mit gültigem Schema enthalten.
Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ ram:AdditionalReferencedDocument[ram:TypeCode = '916']
Test expression (assert/@test)
not(exists(ram:URIID)) or (matches(ram:URIID, $XR-URL-REGEX))