Skip to content

SII XML Creator generates incorrect InversionSujetoPasivo node for Customs – Complementary Settlement (LC) invoices #30130

@BeaLavin81

Description

@BeaLavin81

Why do you need this change?

We have identified an issue in the standard SII XML generation logic within codeunit 10750 “SII XML Creator”.
The system incorrectly generates the XML node:
for purchase invoices classified as: Customs – Complementary Settlement (LC)
These documents are posted using Reverse Charge VAT. However, according to the validation behavior received from AEAT, the presence of the InversionSujetoPasivo node causes the SII submission to be rejected.
Current standard logic identified in codeunit 10750:

local procedure UseReverseChargeNotIntracommunity(
    VATCalcType: Enum "Tax Calculation Type";
    VendNo: Code[20];
    PostingDate: Date;
    InvoiceType: Text): Boolean
var
    VATEntry: Record "VAT Entry";
    SIIInitialDocUpload: Codeunit "SII Initial Doc. Upload";
begin
    exit(
      (VATCalcType = VATEntry."VAT Calculation Type"::"Reverse Charge VAT") and
      (not SIIManagement.VendorIsIntraCommunity(VendNo)) and
      (InvoiceType <> GetF5InvoiceType()) and
      (not SIIInitialDocUpload.DateWithinInitialUploadPeriod(PostingDate)));
end;

The exception currently implemented only excludes invoice type F5:
local procedure GetF5InvoiceType(): Text[2]
begin
    exit('F5');
end;

Because of this implementation, LC invoice types are also considered valid for InversionSujetoPasivo generation.

Steps to reproduce

  1. Create a purchase invoice
  2. Use invoice type “Customs – Complementary Settlement (LC)”
  3. Configure VAT as Reverse Charge VAT
  4. Post the invoice
  5. Generate SII XML
  6. Verify that is generated
  7. Submit XML to AEAT
  8. AEAT rejects the submission

Expected result
should not be generated for LC invoice types.

Actual result
is generated and the SII submission is rejected by AEAT.

Technical object involved
Codeunit 10750 – “SII XML Creator”
Procedure: UseReverseChargeNotIntracommunity

Describe the request

Expected behavior:
For invoice type: Customs – Complementary Settlement (LC) Business Central should NOT generate even when Reverse Charge VAT is used.

Current behavior:
XML includes InversionSujetoPasivo --> AEAT rejects the SII submission
The issue appears to originate from missing LC handling in the Reverse Charge exclusion logic implemented in codeunit 10750 – SII XML Creator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions