SAP Business One in Spain: Veri*factu, SII and NIF checks

By Zain Abbas, Kodenova · Updated

Short answerSAP Business One has an official Spain localization. Spanish companies have three invoicing regimes to plan for: Veri*factu (tamper-evident invoice records with a hash and QR code, legally due 1 January 2027 for corporate taxpayers and 1 July 2027 for others, with a further delay to 2028 announced but not yet published), SII for large companies (VAT ledger records within four working days), and mandatory B2B e-invoicing from 6 October 2027 for companies above 8 million euros. In SAP Business One, Veri*factu runs through the Electronic Document Service, an Electronic File Manager mapping file from SAP Note 3597311 and digital numbering series on A/R invoices, credit memos and down payments.

SAP Business One runs in Spain on an official SAP localization. For a Spanish company the ERP question in 2026 is less about the general ledger and more about invoicing: which of Spain’s three invoicing regimes applies to you, when, and what SAP Business One needs before the first compliant invoice goes out. This page covers what the localization does, the Veri*factu, SII and B2B e-invoicing dates as the AEAT publishes them today, the Veri*factu setup in SAP Business One, and a SQL query that catches broken NIF numbers before the 347 report or the tax agency does.

I am Zain Abbas, a SAP Business One developer with more than 7 years of SAP B1 work for companies in 13 countries. Spain is not one of them, so this page is not a case study. It comes from e-invoicing work on SAP B1 in Ecuador, Guatemala, El Salvador, Panama and Saudi Arabia, where every invoice is signed, numbered and reported to the tax authority, which is close to what Veri*factu asks for. The Spanish rules come from SAP’s documentation and the AEAT’s own pages, linked at the end.

What does the Spain localization of SAP Business One cover?

The localization is chosen when the company database is created and cannot be switched later. SAP’s help for release 10.0 documents these Spain-specific areas:

AreaWhat SAP documents
Veri*factuA/R invoices, A/R credit memos and down payments sent through the Electronic Document Service (EDS), with a mapping file from SAP Note 3597311, a digital series and a certificate; status in the Electronic Document Monitor
SIIImmediate Information Supply (IIS or SII) reporting of VAT ledger records, enhanced for the EU VAT One Stop Shop rules
Tax reportsModel 340, 347 Report (operations with third parties above the reporting threshold), 349 Report (intra-EU), tax report and register books, tax reconciliation, tax declaration boxes
EU reportingEU Sales Report and Intrastat, including the Intracommunitary VAT ID field added for 2022
Withholding taxWithholding tax codes and reports by business partner and by code
BankingSEPA credit transfer and direct debit files, bills of exchange, postdated checks and credit vouchers, Spanish bank account validation
Payment termsMaximum payment periods under Law 15/2010 (60 days from 2013) and the annual report of payments and late payments
OtherExcise tax on non-reusable plastic packaging, sales and purchasing documents with negative totals, self invoices

Which invoicing rules apply in Spain in 2026, 2027 and 2028?

Spain has three regimes that overlap, and a company usually falls under one of the first two plus the third. This is the state on 8 November 2026, from the AEAT’s pages:

RegimeWhoWhat the software must doDates
Veri*factu (RD 1007/2023)Companies and self-employed in the common-regime territory that are not on SIICreate a chained, tamper-evident invoice record for every invoice and cancellation, put a QR code on the invoice, and either send each record to the AEAT (VERI*FACTU mode) or sign and keep the records plus an event log (NO VERI*FACTU mode)Law in force: before 1 Jan 2027 for Corporate Income Tax filers, before 1 Jul 2027 for others. Extension to October 2028 announced on 5 Oct 2026, not yet in the BOE
SIIMonthly VAT filers: turnover above 6 million euros, VAT groups, REDEME, certain fuel warehouse holders; anyone else by choiceSend invoice records for the VAT ledgers within four days, excluding Saturdays, Sundays and national holidaysIn force since 2017
B2B e-invoicing (RD 238/2026)All companies and professionalsIssue, send and receive structured e-invoices through a private platform or the public solution, and report invoice and payment status6 Oct 2027 above 8 million euros; 6 Oct 2028 for everyone else

Three details change how you plan an SAP project:

  • SII and Veri*factu do not stack. The AEAT says companies enrolled in SII are outside the Veri*factu regulation. A large company already on SII does not need the Veri*factu protocol in SAP Business One, and it also does not file models 347 and 390.
  • The Basque Country and Navarra are separate. Veri*factu covers the common-regime territory. The three Basque provinces run TicketBAI through their own tax offices, and SAP’s Spain localization help for Business One does not document a TicketBAI protocol, so a Basque company needs a partner solution. The Canary Islands are inside Veri*factu even though their sales tax is IGIC.
  • An invoice record is not an e-invoice. The AEAT is explicit that a Veri*factu record holds part of the invoice data plus security data, and is never itself an electronic invoice. Veri*factu in 2027 and B2B e-invoicing from October 2027 are two projects, and the B2B one needs a platform.

How do you set up Veri*factu in SAP Business One?

SAP’s help lists the areas. In the order I would do them on a test copy of the company database:

  1. Feature package. SAP strongly recommends the latest feature package and the latest mapping file, because the AEAT’s requirements may still change. Check SAP Note 3597311 before anything else.
  2. Electronic File Manager (Administration > Setup > General > Electronic File Manager). Import the Veri*factu mapping file from SAP Note 3597311.
  3. Document Numbering (Administration > System Initialization > Document Numbering). Every marketing document relevant for Veri*factu needs a digital numbering series.
  4. Document Settings, Electronic Documents tab. Fill the Access Point URL the AEAT specifies. In Documents Mapping Determination, add the document types with their digital series and choose the mapping file as the export format. In Processing Target Setup, open the Veri*factu Connector tab and select the certificate that authenticates SAP Business One in the API calls. The certificate must carry the company name as it appears in Company Details.
  5. Tax groups (Administration > Setup > Financials > Tax > Tax Groups). Set the correct Special Regime and Type of Operation on every VAT group you post with. This is where most of the record content comes from.
  6. Master data. Company Name and Federal Tax ID in Company Details, and the Federal Tax ID on business partners.
  7. EDS. On the EDS web dashboard, select the company database and activate the connectors for the Veri*factu protocol.

Once it runs, an A/R invoice has a Veri*factu section on its Electronic Documents tab, defaulted from Document Settings, and the Fingerprint field fills in when the record is processed. That fingerprint is the huella: the hash that chains each record to the one before it. Day-to-day work happens in Reports > Electronic Document Monitor, where you see the status and run follow-up actions.

What carries over from my clearance-model projects:

  • Numbering first. Digital series is a decision you make once. Switching series in the middle of a fiscal year leaves a gap story you will have to explain, and in a chained-hash system a gap is visible to the tax office by design.
  • Tax groups second. In every country where I have mapped invoices to a tax authority’s schema, the first wave of rejections came from tax codes that meant one thing to the accountant and another to the XML. Map each VAT group to its Veri*factu operation type in a spreadsheet, have your tax adviser sign it off, then configure.
  • Master data third. A record with a wrong customer NIF goes out with that NIF in it. The query below finds those before go-live.

How do you find Spanish customers with an invalid NIF?

Every Spanish tax ID ends in a control character. A DNI is 8 digits and a letter, the letter being position (number mod 23) in the string TRWAGMYFPDXBNJZSQVHLCKE. An NIE starts with X, Y or Z, which count as 0, 1 and 2 for the same calculation. A company NIF (the old CIF) is a letter, 7 digits and a control digit or letter computed from those 7 digits. SAP Business One keeps the number in OCRD.LicTradNum, often with an ES prefix, spaces or dashes.

The 347 Report already lists Spanish business partners with no federal tax ID or no state code, but it does not check whether the number is valid. This query does both, for active Spanish customers:

-- SQL Server: Spanish customers with a missing or invalid NIF, or no bill-to state
SELECT CardCode, CardName, Nif, State1, Problem
FROM (
    SELECT B.CardCode, B.CardName, B.Nif, B.State1,
        CASE
            WHEN B.Nif = '' THEN 'Missing tax ID'
            WHEN B.Nif LIKE '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z]' THEN
                CASE WHEN RIGHT(B.Nif, 1) = SUBSTRING('TRWAGMYFPDXBNJZSQVHLCKE',
                          CAST(LEFT(B.Nif, 8) AS INT) % 23 + 1, 1)
                     THEN 'OK' ELSE 'DNI letter wrong' END
            WHEN B.Nif LIKE '[XYZ][0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z]' THEN
                CASE WHEN RIGHT(B.Nif, 1) = SUBSTRING('TRWAGMYFPDXBNJZSQVHLCKE',
                          CAST(CAST(CHARINDEX(LEFT(B.Nif, 1), 'XYZ') - 1 AS VARCHAR(1))
                               + SUBSTRING(B.Nif, 2, 7) AS INT) % 23 + 1, 1)
                     THEN 'OK' ELSE 'NIE letter wrong' END
            WHEN B.Nif LIKE '[ABCDEFGHJNPQRSUVW][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9A-J]' THEN
                CASE WHEN RIGHT(B.Nif, 1) IN (CHAR(48 + C.Ctrl), SUBSTRING('JABCDEFGHI', C.Ctrl + 1, 1))
                     THEN 'OK' ELSE 'Company NIF control wrong' END
            ELSE 'Unknown NIF format'
        END AS Problem
    FROM (
        SELECT CardCode, CardName, State1,
               CASE WHEN LEFT(V, 2) = 'ES' AND LEN(V) = 11 THEN SUBSTRING(V, 3, 9) ELSE V END AS Nif
        FROM (
            SELECT CardCode, CardName, ISNULL(State1, '') AS State1,
                   UPPER(REPLACE(REPLACE(REPLACE(ISNULL(LicTradNum, ''), ' ', ''), '-', ''), '.', '')) AS V
            FROM OCRD
            WHERE CardType = 'C' AND Country = 'ES' AND frozenFor = 'N'
        ) R
    ) B
    CROSS APPLY (
        -- company NIF control: digits 1, 3, 5, 7 doubled and digit-summed, digits 2, 4, 6 added
        SELECT (10 - (
              (2 * (ASCII(SUBSTRING(B.Nif, 2, 1)) - 48)) / 10 + (2 * (ASCII(SUBSTRING(B.Nif, 2, 1)) - 48)) % 10
            + (2 * (ASCII(SUBSTRING(B.Nif, 4, 1)) - 48)) / 10 + (2 * (ASCII(SUBSTRING(B.Nif, 4, 1)) - 48)) % 10
            + (2 * (ASCII(SUBSTRING(B.Nif, 6, 1)) - 48)) / 10 + (2 * (ASCII(SUBSTRING(B.Nif, 6, 1)) - 48)) % 10
            + (2 * (ASCII(SUBSTRING(B.Nif, 8, 1)) - 48)) / 10 + (2 * (ASCII(SUBSTRING(B.Nif, 8, 1)) - 48)) % 10
            + (ASCII(SUBSTRING(B.Nif, 3, 1)) - 48) + (ASCII(SUBSTRING(B.Nif, 5, 1)) - 48)
            + (ASCII(SUBSTRING(B.Nif, 7, 1)) - 48)
        ) % 10) % 10 AS Ctrl
    ) C
) X
WHERE Problem <> 'OK' OR State1 = ''
ORDER BY Problem, CardCode
-- SAP HANA version
SELECT "CardCode", "CardName", "Nif", "State1", "Problem"
FROM (
    SELECT B."CardCode", B."CardName", B."Nif", B."State1",
        CASE
            WHEN B."Nif" = '' THEN 'Missing tax ID'
            WHEN B."Nif" LIKE_REGEXPR '^[0-9]{8}[A-Z]$' THEN
                CASE WHEN RIGHT(B."Nif", 1) = SUBSTRING('TRWAGMYFPDXBNJZSQVHLCKE',
                          MOD(TO_INTEGER(LEFT(B."Nif", 8)), 23) + 1, 1)
                     THEN 'OK' ELSE 'DNI letter wrong' END
            WHEN B."Nif" LIKE_REGEXPR '^[XYZ][0-9]{7}[A-Z]$' THEN
                CASE WHEN RIGHT(B."Nif", 1) = SUBSTRING('TRWAGMYFPDXBNJZSQVHLCKE',
                          MOD(TO_INTEGER(TO_VARCHAR(LOCATE('XYZ', LEFT(B."Nif", 1)) - 1)
                                         || SUBSTRING(B."Nif", 2, 7)), 23) + 1, 1)
                     THEN 'OK' ELSE 'NIE letter wrong' END
            WHEN B."Nif" LIKE_REGEXPR '^[ABCDEFGHJNPQRSUVW][0-9]{7}[0-9A-J]$' THEN
                CASE WHEN RIGHT(B."Nif", 1) IN (CHAR(48 + B."Ctrl"), SUBSTRING('JABCDEFGHI', B."Ctrl" + 1, 1))
                     THEN 'OK' ELSE 'Company NIF control wrong' END
            ELSE 'Unknown NIF format'
        END AS "Problem"
    FROM (
        SELECT N.*,
            MOD(10 - MOD(
                  FLOOR(2 * (ASCII(SUBSTRING(N."Nif", 2, 1)) - 48) / 10) + MOD(2 * (ASCII(SUBSTRING(N."Nif", 2, 1)) - 48), 10)
                + FLOOR(2 * (ASCII(SUBSTRING(N."Nif", 4, 1)) - 48) / 10) + MOD(2 * (ASCII(SUBSTRING(N."Nif", 4, 1)) - 48), 10)
                + FLOOR(2 * (ASCII(SUBSTRING(N."Nif", 6, 1)) - 48) / 10) + MOD(2 * (ASCII(SUBSTRING(N."Nif", 6, 1)) - 48), 10)
                + FLOOR(2 * (ASCII(SUBSTRING(N."Nif", 8, 1)) - 48) / 10) + MOD(2 * (ASCII(SUBSTRING(N."Nif", 8, 1)) - 48), 10)
                + (ASCII(SUBSTRING(N."Nif", 3, 1)) - 48) + (ASCII(SUBSTRING(N."Nif", 5, 1)) - 48)
                + (ASCII(SUBSTRING(N."Nif", 7, 1)) - 48), 10), 10) AS "Ctrl"
        FROM (
            SELECT "CardCode", "CardName", IFNULL("State1", '') AS "State1",
                   CASE WHEN LEFT(V, 2) = 'ES' AND LENGTH(V) = 11 THEN SUBSTRING(V, 3, 9) ELSE V END AS "Nif"
            FROM (
                SELECT "CardCode", "CardName", "State1",
                       UPPER(REPLACE(REPLACE(REPLACE(IFNULL("LicTradNum", ''), ' ', ''), '-', ''), '.', '')) AS V
                FROM OCRD
                WHERE "CardType" = 'C' AND "Country" = 'ES' AND "frozenFor" = 'N'
            ) R
        ) N
    ) B
) X
WHERE "Problem" <> 'OK' OR "State1" = ''
ORDER BY "Problem", "CardCode"

Notes from running checks like this:

  • I tested the logic, not your data. The control rules above return valid for the published NIFs of Telefónica (A28015865) and the AEAT itself (Q2826000H) and catch a one-digit change in either. Run the query on a test copy first and read the “Unknown NIF format” rows by hand: foreign customers created with Country = ES, and old entries with the full name in the tax ID field, land there.
  • Letter or digit. The query accepts either form of the company control character. Strictly, some entity letters (for example P, Q, R, S, N and W) take a letter and others (A, B, E, H) take a digit; tighten it if your auditor wants that.
  • Vendors too. Change CardType to ‘S’. Purchase invoices feed the 347 and the SII received-invoice ledger, so a bad vendor NIF is just as visible.
  • State code. State1 is the bill-to state on the business partner. The 347 Report lists Spanish partners without one in its error report, so fixing it here clears that list too.
  • Then block new ones. Add the same check to SBO_SP_TransactionNotification for object 2 (business partners), so a new Spanish customer cannot be saved with a broken NIF. The TransactionNotification examples show the pattern.

The OCRD page lists the business partner fields, and the SQL to HANA converter rewrites other queries between the two dialects.

Which ERP systems are common in Spain?

Small and mid-sized Spanish companies often run software from domestic or long-established local vendors, such as a3ERP and a3innuva from Wolters Kluwer, Sage 50 and Sage 200, and cloud tools like Holded for the smallest businesses. Companies that belong to an international group, or trade across the EU, more often run SAP Business One, Microsoft Dynamics 365 Business Central, Odoo or Oracle NetSuite. Veri*factu applies to all of them equally, so the vendor’s own Veri*factu release, and later its B2B platform connection, matter more than the brand. The ERP Selector compares systems by country requirement.

What can Kodenova do for SAP Business One users in Spain?

I work remotely from Pakistan, 4 hours ahead of mainland Spain in winter and 3 in summer. The Spanish working day from 9:00 to 14:00 is my afternoon, so meetings fit without anyone working at night. What I do:

  • Master data clean-up before Veri*factu: NIF, state codes and tax groups, with queries like the one above and a list of what to fix.
  • Validation rules in SBO_SP_TransactionNotification: block a Spanish customer with an invalid NIF, or an A/R invoice on a series that is not digital.
  • Integrations through the Service Layer: web shops, CRM, banks, and later the B2B platform your company picks for October 2027 or 2028. See the Service Layer guide.
  • Queries, reports and SQL Server to HANA migration. See the migration guide.
  • AI on top of SAP B1: an MCP server so ChatGPT or Claude can answer from live SAP data, with permissions.

To be clear about scope: the e-invoicing integrations I have built are for Saudi Arabia, Ecuador, Guatemala, El Salvador and Panama. For Spain I do not sell a Veri*factu, SII or TicketBAI product. Veri*factu in SAP Business One is SAP’s standard feature, configured by your partner; I work on the SAP side around it, and I do not give tax advice. Kodenova is not an SAP partner and does not resell licences; if you have a partner for licences and support, I work alongside them on development. Other country pages: France, Italy, Germany and the full list on the SAP Business One hub.

Sources

Related services

FAQ

Frequently asked questions

Does SAP Business One support Veri*factu?

Yes. SAP documents Veri*factu for the Spain localization of SAP Business One and SAP Business One, version for SAP HANA. A/R invoices, A/R credit memos and down payments go through the Electronic Document Service, using an Electronic File Manager mapping file listed in SAP Note 3597311, a digital numbering series and a certificate. SAP recommends the latest feature package because the requirements may change, and publishes its responsible declaration under Certificates on the SAP Help Portal.

When does Veri*factu become mandatory in Spain?

The law in force (Real Decreto-ley 15/2025) says companies that file Corporate Income Tax must have adapted invoicing systems before 1 January 2027 and all other taxpayers before 1 July 2027. On 5 October 2026 the Ministry of Finance announced a planned extension, reported as October 2028, to align Veri*factu with B2B e-invoicing. Until that change is published in the BOE, plan against the 2027 dates.

Do companies on SII also need Veri*factu?

No. The AEAT says taxpayers enrolled in SII, whether by obligation or by choice, are excluded from the Veri*factu regulation. SII is mandatory for monthly VAT filers: large companies with turnover above 6 million euros, VAT groups, companies registered in REDEME and, since 1 January 2025, certain fuel tax warehouse holders. SII companies also do not file models 347 and 390.

When is B2B e-invoicing mandatory in Spain?

Real Decreto 238/2026 created mandatory e-invoicing between companies and professionals, and the clock started when Orden HAC/1028/2026 came into force on 6 October 2026. Companies with an operations volume above 8 million euros must issue, send and receive e-invoices and report invoice and payment status from 6 October 2027. All other companies and professionals follow on 6 October 2028.

Does Veri*factu apply in the Basque Country, Navarra and the Canary Islands?

The AEAT applies the regulation to taxpayers domiciled in the common-regime territory, which excludes residents of the Basque Country and Navarra. The Basque provinces run TicketBAI through their own tax authorities. The Canary Islands are common-regime territory for this purpose, so Veri*factu applies there even though sales carry IGIC instead of IVA.

Can a developer outside Spain work on a Spanish SAP Business One system?

Yes, with agreed access, a data processing agreement under the GDPR and fixed working hours. Kodenova works remotely from Pakistan, 4 hours ahead of mainland Spain in winter and 3 in summer, so the Spanish morning and early afternoon are shared working time. I work in English; the AEAT texts linked on this page are the reference for tax questions.

Ready to get started?

Tell us what you need. You get a clear technical answer, a fixed scope and a price, usually within 24 hours.