SAP Knowledge Base Article - Public

3721355 - Portugal SAF-T generated with error. Element Name CustomerID

Symptom

Portugal SAF-T (E-Fatura, Accounting) report file generated with errors.

  • Query R_PAYMENT_CUSTOMERID returns more than one record.
    Value is not of the min. required length 1.
    Element Name: CustomerID

  • Query BPFORHEADER returns more than one record. Use query row key in data mapping.
    Value is not of the min. required length 1.
    Element Name: CustomerID

  • Query PAYMENT_VALUES returns more than one record. Use query row key in data mapping.
    Value is not of the min. required length 1.
    Element Name: CustomerID


Environment

SAP S/4HANA Cloud Public Edition.

Reproducing the Issue

  1. Open the "Run Statutory reports" app.
  2. Run the Portugal E-Fatura PT_SAFT_EFATURA report or Portugal SAF-T Accounting PT_SAFT_ACCOUNTING 
  3. The report is generated with error:

    Query R_PAYMENT_CUSTOMERID returns more than one record.
    Error message: "Value is not of the min. required length 1".

    Query BPFORHEADER returns more than one record. Use query row key in data mapping.
    Value is not of the min. required length 1.
    Element Name: CustomerID

    Query PAYMENT_VALUES returns more than one record. Use query row key in data mapping.
    Value is not of the min. required length 1.
    Element Name: CustomerID



Cause

Journal entry created with multiple customers, which is non-compliant with the SAF-T structure.

Please consider the following Portugal-specific information for processing your payments/account clearing:

  • During payment/account clearing processing, you must use only one customer ID in a payment document.

    If more than one customer ID is used in the same payment document, the system stores the different customer IDs at item level in the payment document items, and does not identify a customer ID at document header level.

    In such a case, when you generate the SAF-T file, the system will not be able to identify which customer ID to insert in the XML file from item level, and does not find an ID in the document at header level either. In this case, the system leaves the field empty in the XML file, which results in a validation error.

  • Do not use the same business partner ID as a customer ID and a supplier ID in the same document.

    If you use a business partner ID as customer ID and supplier ID in the same document for payments/account clearing, a validation error comes up when you try to generate the SAF-T file. When you create a payment document during payment/account clearing processing and you use a BP as a customer and also as a supplier, the system creates two BP lines in the payment document. In this case, the BP data is saved at item level. However, when you generate the SAF-T file, the system won’t be able to find a BP ID in the payment document header to include in the XML file. In this case, the system leaves the field empty in the XML file, which results in a validation error.

    You can use a business partner ID either as customer or as supplier, but not for both in the same document.

Resolution

The steps below outline how to identify the journal entry created for multiple customers.

  1. Download and open the XML report file using an XML Editor.
  2. Search for <CustomerID/>
  3. Identify transactions where the CustomerID field is empty.
  4. Recognize that transactions with multiple customers are not supported by the SAF-T structure.
  5. Contact the local business user, auditor, or legal advisor to explain the validation error to the Tax Authority.

See Also

  • KBA 3709018 - SAF-T PT Accounting file generated with errors.
  • Help Documentation: Portugal

Keywords

pt saf-t e-fatura, customerid error, xml file error, empty customerid, r_payment_customerid, statutory reports, portugal saf-t, pt_saft_efatura_file, journal entry, multiple customers, saf-t structure, validation error, tax authority, PT_SAFT_ACCOUNTING, Value is not of the min. required length 1, CustomerID , KBA , FI-LOC-SAF-PT , Portugal , Problem

Product

SAP S/4HANA Cloud Public Edition all versions