# Electronic invoicing in Spain
This article provides information about how to set up and work with the Spanish localization of the E-Document framework.
## E-documents framework setup
See Set up e-documents</finance-how-setup-edocuments> for information about how to set up the E-Documents framework.
## Set up local formats
To set up the format for the E-Document service, follow these steps:
1. Select Search (Alt+Q) in the upper-right corner, enter E-Document Services, and then select the related link.
1. Select New, and on the E-Document Services page, on the General FastTab, in the Document Format field, choose Factura-E 3.2.2.
1. Configure the fields as described in Set up e-documents</finance-how-setup-edocuments>.
1. Close the page.
For use in sales, set up the workflow as described in /finance-how-setup-edocuments#set-up-the-workflow. Then, on the Document Sending Profile page, add the workflow for the customers you send e-invoices to.
## Work with e-invoices
Use the E-Documents framework in purchases as described in Use e-documents in the purchases process</finance-how-use-edocuments-purchase>. See Use e-documents in the sales process</finance-how-use-edocuments> for information about the sales process.
> NOTE
> The following nodes are determined using the following methods:
 > InvoiceIssueData/ExchangeRateDetails/ExchangeRateDate is taken as the Posting Date of the document.
 > InvoiceHeader/InvoiceClass comes from the document's Invoice Type, which uses the SII sales invoice types. F1, F2, and F3 produce OO for an original invoice. F4 produces OC for a summary. Other types produce OR for a corrective invoice.
 > InvoiceLine/UnitOfMeasure is included when the unit of measure's International Standard Code matches a supported Factura-E unit. If there's no match, the optional node is omitted.
### Corrections with credit memos
When you work with credit memos, before you post, on the Credit Memo Details FastTab add a reason code in the Factura-E Reason Code field. Factura-E validation requires this code when you export a sales credit memo.
> NOTE
> The Corrective/TaxPeriod/StartDate-EndDate nodes are determined using the following method:
> 1. Use the posted credit memo's Posting Date, not the original invoice's date.
> 1. If a VAT Return Period contains that date, use its start and end dates.
> 1. Otherwise, use the latest Accounting Period start on or before that date and the end of its fiscal year.
> 1. If no accounting period is found, use the calendar year that contains the credit memo's posting date.
## Related information
 Set up e-documents</finance-how-setup-edocuments>
 How to use e-documents in sales</finance-how-use-edocuments>
 How to use e-documents in purchase</finance-how-use-edocuments-purchase>
 Spanish Local Functionality<spain-local-functionality>
Find free e-learning modules for Business Central here<https://learn.microsoft.com/training/dynamics365/business-central>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/localfunctionality/spain/spain-einvoicing, MicrosoftDocs/dynamics365smb-docs at 46907ac (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/localfunctionality/spain/spain-einvoicing/
