Manual
VAMPIRE ABAPInstall, work, configure
einvoice4s / Manuals / VAMPIRE ABAP

VAMPIRE ABAP

Applies to version 1.0.0. As of 17 November 2026.

1 · What it does

VAMPIRE ABAP validates electronic invoices entirely inside SAP. It checks XRechnung, ZUGFeRD and Factur-X as XML, Peppol invoices and the national adaptations of the standard EN 16931 against their rule sets, and it names every violation with its rule, message and location. On request it writes the validation report in the format of the KoSIT validator.

The validation is available in three places:

WhereWhat for
Report ZSPE_VAMP_CHECKA clerk checks an XML file from the workstation or the XML invoice that is linked in ArchiveLink to a posted document.
Function module ZSPE_VAMP_VALIDATEOther programs and external callers check an invoice through a remote-enabled function module.
Class ZCL_SPE_VAMP_VALIDATORYour own ABAP programs check an invoice with a single method call.

VAMPIRE ABAP follows these principles:

  • Nothing leaves the system. The validation runs entirely in the ABAP stack. It needs neither Java nor an additional server, and it calls no address on the internet.
  • The rules are data, not code. The rule sets come as a ZIP file of their own, the rule packages. A new rule release is imported as a new package ZIP, and the ABAP code stays unchanged.
  • One table of its own, nothing else. VAMPIRE ABAP writes only into its table ZSPE_VAMP_PKG, which holds the imported rule packages. It changes no application table, nothing in the archive and nothing in the SAP standard.
  • One package that can be removed without a trace. All objects are in a single abapGit package. VAMPIRE ABAP creates nothing outside this package.

2 · Requirements

WhatRequirement
SAP systemAn SAP system on basis 7.40 from SP08, or S/4HANA on-premise
abapGitThe report ZABAPGIT in the system. If you do not want to keep abapGit in the system, install the standalone version ZABAPGIT_STANDALONE for the installation only and delete it afterwards. The source code is a single file: download zabapgit_standalone.prog.abap ( right click, "Save link as" ). The installation guide of abapGit describes how to create the report from it in SE38.
WorkstationSAP GUI, because both reports load their files from the workstation through the file dialog of the SAP GUI
AuthorisationCreating a package and importing objects into the development system
E-invoicesThe invoices are XML files in UTF-8, either as a file or in ArchiveLink at the document

3 · Installation

After your purchase on einvoice4s.de you receive two ZIP files:

FileContent
vampire-abap-abapgit.zipThe ABAP package for abapGit
vampire-abap-packages.zipThe rule packages in their newest state. The report ZSPE_VAMP_IMPORT shows the day of that state after the import.

The rule packages come separately from the ABAP package because they change with every new rule release. Do not unpack either file. abapGit and the report ZSPE_VAMP_IMPORT read them as they are.

For a first test without a transport

The classes of the validation contain unit tests. If you want to run them, start them in SE80 or in Eclipse with "Unit Test". They need no imported rule packages.

For productive use

Instead of the local package, create a package of your own that can be transported, for example ZSPE_VAMP, and choose it in step 2. abapGit then asks for a transport request. From there the objects move through your system landscape like any development of your own. Chapter 9 describes how the rule packages reach the follow-on systems.

What the package contains

ObjectTypeTask
ZSPE_VAMP_IMPORTReportImports the package ZIP, lists the imported rule packages and deletes them on request
ZSPE_VAMP_CHECKReportChecks an XML file or the XML invoice at a posted document and shows the findings as a list
ZSPE_VAMP_VALIDATEFunction module in the function group ZSPE_VAMPThe same validation for other programs, also through RFC
ZCL_SPE_VAMP_VALIDATORClassThe entry point for your own ABAP programs
ZSPE_VAMP_PKGTableThe imported rule packages, compressed, with checksum, import date and user
ZSPE_VAMP_FINDING, ZSPE_VAMP_FINDINGSStructure and table typeOne line of the list of findings and the list itself, as the function module returns them
ZCL_SPE_VAMP_* ( the others ) and ZCX_SPE_VAMP_ERRORClassesThe validation itself and the exception class

There is no transaction. You start both reports in SE38 or SA38.

4 · Importing the rule packages

Without rule packages VAMPIRE ABAP checks nothing. Import the package ZIP directly after the installation for this reason.

The heading of the list states how many packages were imported, how many were refused and the build date of the package ZIP, for example "93 packages imported, 0 refused (ZIP of 2026-11-03)".

Note: With German as the logon language, both reports write umlauts as ae, oe and ue, so that no code page of a system can change them. In English the texts contain no umlauts.

What the list shows

Every package appears in the column "Result" with one of the following values:

ResultMeaning
NewThe package was not yet in the table and is now imported. In a test run it is followed by "(test run)".
ChangedThe package was in the table in a different state and is now replaced. In a test run it is followed by "(test run)".
UnchangedThe package is already in the table in exactly this state. It is not written again.
RefusedThe package was not written. The column "Reason" states why.
RemovedThe package was in the table, but the new package ZIP no longer contains it, so it was deleted.
Not in the ZIP, keptThe new package ZIP no longer contains the package, and it stays in the table anyway, because "Remove packages not in ZIP" was not ticked or because it was a test run.

A package is refused when its checksum or its size does not match the manifest of the ZIP, when its file is missing in the ZIP or damaged, or when it is built for a newer version of VAMPIRE ABAP. A refused package overwrites nothing: an older state of the same package stays in the table and remains in use.

The other columns show the set the package belongs to ( DEFAULT for the standard validation, EDITION for the packages per ZUGFeRD edition ), the kind of package ( RULESET for a rule set, SCHEMA for a structure model, CONFIG for a configuration file ), its identifier, its format number, its size in bytes, the identifier of the package ZIP and its build date.

If the file cannot be read as a package ZIP at all, a message appears instead of the list, for example "The file is not a ZIP archive." or "The ZIP holds no manifest.json; it is not a package ZIP of VAMPIRE ABAP." Nothing is written in this case.

Viewing the imported packages

With "List the imported packages" the report shows every package that is in the table, with import date, time and user. A package that is built for a newer version of VAMPIRE ABAP carries the sentence "Built for a newer release of the engine; not used." in the column "Reason".

Which formats the package ZIP covers

The package ZIP of 03.11.2026 contains 93 packages and covers these formats:

FamilyScenarios
XRechnung 3.0UBL Invoice, UBL CreditNote and CII, plus the variants Extension ( UBL Invoice and CII ) and CVD ( UBL Invoice, UBL CreditNote and CII )
EN 16931UBL Invoice, UBL CreditNote and CII
PeppolPeppol Billing BIS 3 as UBL Invoice and UBL CreditNote, Peppol Italia AGID
National adaptationsCIUS-RO eFactura, CIUS-PT, UBL.BE and CIUS-RS
ZUGFeRD / Factur-XThe profiles MINIMUM, BASIC WL, BASIC, EN16931 and EXTENDED, each in the ZUGFeRD editions 2.1, 2.2, 2.3.2, 2.3.3, 2.4, 2.5 and 2.5.2

A later package ZIP can contain further formats and newer editions. "List the imported packages" shows which packages are in your system.

5 · Checking an invoice

The invoice from the archive

The report looks for the invoice at the accounting document and at its origin document, that is at the invoice document for a MIRO invoice and at the billing document for a billing document. It goes through the linked documents from the newest to the oldest and takes the first one that contains XML. It recognises XML by the content of a document and not by its document type. For this it reads the header of the accounting document ( BKPF ) and the documents through ArchiveLink; it writes nothing into the archive.

If the report finds no XML, it states the reason:

  • If only a PDF is linked to the document, for example a ZUGFeRD PDF, it reports "Only a PDF is linked to the document. VAMPIRE ABAP checks the XML of the invoice; please check that as a file."
  • If no invoice at all is linked to the document, it reports that no XML invoice is linked in the archive to this document.
  • If the document does not exist, it reports that the document was not found in the company code.

Important: VAMPIRE ABAP does not read PDF files. For a ZUGFeRD or Factur-X invoice it checks the embedded XML file. If the invoice is available only as a PDF, extract the XML file with another tool and check it with "From an XML file".

Character encoding

VAMPIRE ABAP reads every invoice as UTF-8. This is the encoding of the e-invoice formats according to EN 16931. A file in another character encoding counts as not well-formed as soon as it contains characters outside ASCII, for example an umlaut.

6 · Reading the result

The header lines

These details appear above the list:

LineContent
Result"Accepted", "Accepted with warnings", "Rejected" or "No verdict possible"
ScenarioThe rule set the invoice was checked against, for example "EN16931 XRechnung (CII)". For XRechnung and ZUGFeRD the chosen edition follows, for example "edition ZUGFeRD / Factur-X 2.5.2".
ReasonA sentence explaining why this edition was chosen ( chapter 7 )
CountsThe number of errors, warnings and notes
Not importedA rule package that the invoice would have needed and that is not in the table
Notices of the rule setsA notice that a rule set brings along, for example the notice on the ZUGFeRD rules
Package problemsAn imported package that this session could not use, with the reason
RuntimeThe duration of the first check and the part of it spent reading the packages from the table; with several repetitions also the average of the further checks

"No verdict possible" means that the validation could not run completely, for example because a required rule package is missing or because the invoice matches no known scenario. The invoice is then neither accepted nor rejected.

The list of findings

Every line of the list is one finding:

ColumnContent
StageThe validation stage in which the finding arose: wellformed for the well-formedness of the XML, xsd for the structure, syntax for the rules of the syntax and business for the business rules
Severityfatal for an error, warning for a warning, information for a note
RuleThe identifier of the rule, for example BR-CO-10. Some findings carry no identifier, for example the finding on well-formedness.
MessageThe text of the rule
LocationThe place in the invoice as an XPath
TermsThe business terms of the standard that the finding concerns, for example BT-106, separated by commas

Three further columns are hidden and can be shown through the layout function of the list: "Per rule set" shows the severity that the rule set itself states, "Rule sets" names the rule sets the finding comes from, and "Origin" names the part of the validation that produced it. You can sort, filter and export the list like any ALV list.

The stages run in this order. If the structure check fails, VAMPIRE ABAP no longer checks the rules, and the list contains only the findings on the structure. A file that is not well-formed XML gives the result "Rejected" with exactly one finding of the stage wellformed, whose message describes the error in the XML.

The KoSIT report

If "Save the KoSIT report" is ticked, the report opens the file dialog of the SAP GUI after the check. It proposes the name of the invoice with the ending -kosit-report.xml; for an invoice from the archive the name is <company code>-<document number>-<fiscal year>-kosit-report.xml. The report has the format of the validation report of the KoSIT validator, starts with the element rep:report and is saved as UTF-8. A report is written even for a file that is not well-formed XML.

Language

Messages, column headings and the sentences of the validation appear in German when you are logged on in German, and in English otherwise.

7 · Which edition is checked

XRechnung and ZUGFeRD exist in several editions, and every edition has rules of its own. The invoice itself, however, does not always state which edition it was created for. If "Choose edition automatically" is ticked, VAMPIRE ABAP therefore picks the edition by itself, and it does so in a different way for each family:

FamilyHow the edition is chosen
XRechnung 3.0The invoice date determines the edition. Every edition has a period of validity, and the edition whose period contains the invoice date applies. If its rule package is not included, VAMPIRE ABAP checks with the nearest included edition.
ZUGFeRD / Factur-XVAMPIRE ABAP first checks the invoice with the newest included edition and then moves on to the older ones. The first edition that accepts the invoice applies. If no edition accepts it, the report of the newest edition applies. An acceptance with warnings counts as an acceptance.
all other formatsThere is only one edition, and the invoice is checked as without the tick.

The sentence below the scenario states why the edition was chosen. These sentences occur:

SentenceMeaning
"The invoice date … lies in the validity period of edition …"The XRechnung was checked with the edition that was valid on its date.
"… Its rule package is not included; the invoice was checked with …, the nearest included edition."The edition of the invoice date is known, but its rule package is not included.
"The invoice date … lies in no known validity period; the invoice was checked with edition …"The date lies before or outside all known periods.
"The invoice states no readable invoice date; it was checked with the newest included edition …"Without a date the newest edition applies.
"The newest edition … accepts the invoice."The ZUGFeRD invoice matches the newest edition.
"The newer editions … do not accept the invoice; … is the newest edition that accepts it."The ZUGFeRD invoice only matches an older edition.
"None of the checked editions accepts the invoice; the report of the newest edition … applies."The ZUGFeRD invoice is valid in no edition, and the findings come from the newest one.
"There is no edition cascade for this format; the invoice was checked as in a single check."The invoice belongs to no family with several editions, for example a Peppol invoice.
"The file is not well-formed XML, so there is no cascade."The file could not be read.

The report and the function module never check an invoice against all editions at once, because such a check needs a great deal of memory. The class offers it for a background program ( chapter 8 ).

8 · Calling it from your own programs

Through the class

The class ZCL_SPE_VAMP_VALIDATOR checks an invoice with the method validate. It receives the bytes of the XML file and returns the result as a structure:

DATA ls_result TYPE zcl_spe_vamp_validator=>ty_result.

TRY.
    ls_result = zcl_spe_vamp_validator=>validate( iv_xml   = lv_xml       " the bytes of the XML file
                                                  iv_kosit = abap_true ). " also the KoSIT report
  CATCH zcx_spe_vamp_error INTO DATA(lx_error).
    " No check could run at all, for example because no packages are imported.
ENDTRY.
" ls_result-verdict:   accepted, warnings, rejected or no-verdict
" ls_result-findings:  the findings as a table of type ZSPE_VAMP_FINDINGS
" ls_result-kosit_xml: the KoSIT report

The method has these parameters:

ParameterMeaning
IV_XMLThe bytes of the XML file in UTF-8. Mandatory.
IV_NAMEThe file name that appears in the KoSIT report
IV_KOSITabap_true also creates the KoSIT report. The default is abap_false.
IV_LANGde or en for the language of the sentences. Without a value the logon language applies.
IV_CASCADEThe choice of edition from chapter 7. The default is abap_true.
IV_FULLabap_true additionally checks the invoice against all included editions. The chosen edition and the result stay the same as without this parameter. The default is abap_false.

Important: Set IV_FULL only in a background program. The check against all editions keeps every edition package in memory at the same time and therefore needs far more memory than a dialog or RFC session receives.

Among other fields, the result structure contains accepted ( accepted or not ), no_verdict ( no verdict possible ), verdict, scenario, family and edition ( the chosen edition ), reason ( the sentence from chapter 7 ), counts with the fields fatal, warning and information, findings, kosit_xml and duration_ms.

A file that is not well-formed XML raises no exception but gives the result rejected with one finding of the stage wellformed. The exception ZCX_SPE_VAMP_ERROR means that no check could run at all, because no rule packages are imported or a package is broken. Its text states the reason.

Through the function module

The function module ZSPE_VAMP_VALIDATE is remote-enabled and runs the same validation:

DATA lt_findings TYPE zspe_vamp_findings.
DATA lv_verdict  TYPE string.

CALL FUNCTION 'ZSPE_VAMP_VALIDATE'
  EXPORTING
    iv_xml      = lv_xml
  IMPORTING
    ev_verdict  = lv_verdict
    et_findings = lt_findings
  EXCEPTIONS
    failed      = 1
    OTHERS      = 2.
IF sy-subrc <> 0.
  " No check could run at all; the reason is in the message ( sy-msgv1 to sy-msgv4 ).
ENDIF.
ParameterDirectionMeaning
IV_XMLImportThe bytes of the XML file in UTF-8
IV_NAMEImport, optionalThe file name for the KoSIT report
IV_KOSITImport, optionalX creates the KoSIT report
IV_CASCADEImport, default XThe choice of edition from chapter 7
EV_ACCEPTEDExportX when the invoice is accepted
EV_NO_VERDICTExportX when no verdict was possible
EV_VERDICTExportaccepted, warnings, rejected or no-verdict
EV_SCENARIOExportThe chosen scenario
EV_FAMILY, EV_EDITIONExportThe family and the chosen edition
EV_FATAL, EV_WARNING, EV_INFORMATIONExportThe number of errors, warnings and notes
ET_FINDINGSExportThe findings, one line per finding
EV_KOSIT_XMLExportThe KoSIT report as XML
EV_DURATION_MSExportThe runtime in milliseconds
FAILEDExceptionNo check could run at all. The message states the reason.

Only the class returns the sentence explaining why an edition was chosen; the function module does not.

For a first test you can call the function module in SE37 and enter the content of a file for IV_XML. The test environment of SE37 cannot load a file directly; the report ZSPE_VAMP_CHECK is therefore more convenient for the first test.

Many invoices in one session

The first check of a session reads the rule packages from the table and prepares the rule package that the invoice needs. Every further check in the same session reuses it and is therefore much faster. A background job over many invoices thus reads and prepares each rule package only once. An RFC caller that keeps the connection open benefits in the same way; a caller that opens a new connection for every invoice pays for the preparation every time.

9 · Transport and clients

The table ZSPE_VAMP_PKG is client-independent and has delivery class C. An imported rule release therefore applies to all clients of a system. There are two ways to bring it into the follow-on systems:

The report requires a workbench request and not a customizing request, because the table is client-independent. If you choose no request, it reports "No transport request chosen; the packages are imported but not recorded."

Note: In a local package such as $ZSPE_VAMP only the first way is possible, because the table itself is not transported.

10 · Updating

Importing a new rule release

A new rule release comes as a new package ZIP and is imported in the same way as the first one ( chapter 4 ). Packages that have not changed then appear in the list as "Unchanged", new ones as "New" and changed ones as "Changed".

"Remove packages not in ZIP" is ticked by default. Packages that the new package ZIP no longer contains are then deleted from the table and appear in the list as "Removed". If you want to keep them, remove the tick; they then appear in the list as "Not in the ZIP, kept".

A session in which new packages were imported uses the new release from the next check on. Other sessions that have already loaded the packages keep the old release until they end.

Installing a new version of VAMPIRE ABAP

A new version of VAMPIRE ABAP comes as a new ZIP file for abapGit. In the existing offline repository, choose "Import ZIP" with the new file and run "Pull". The imported rule packages stay in the table.

If the report ZSPE_VAMP_IMPORT refuses a package with the reason that it is built for a newer release of the engine, the package ZIP needs a newer version of VAMPIRE ABAP. In that case install the new version first and then the package ZIP.

11 · Removing

VAMPIRE ABAP creates nothing outside the package, so nothing remains after these three steps.

12 · Questions and problems

The report says "No rule packages are imported". The table is empty. Import the package ZIP with the report ZSPE_VAMP_IMPORT ( chapter 4 ).

The result is "No verdict possible". A rule package that the invoice needs is missing from the table, or the invoice matches no known scenario. If a package is missing, the header line "Not imported" names it. Import the current package ZIP.

A package appears above the list with the sentence "The checksum of the content no longer matches; please import the package again." VAMPIRE ABAP checks the checksum of every package again at its first use in a session. A table entry that was changed by hand or damaged in a transport is therefore not used. Import the package ZIP again.

An invoice with umlauts counts as not well-formed. The file is not saved in UTF-8. VAMPIRE ABAP reads UTF-8 only ( chapter 5 ).

The report says that only a PDF is linked to the document. VAMPIRE ABAP checks only the XML file of an invoice. Extract the XML file from the PDF and check it with "From an XML file".

The first check takes longer than the following ones. The first check of a session reads the rule packages from the table and prepares the matching rule package. Every further check in the same session reuses it ( chapter 8 ).

A package is refused during the import. The column "Reason" states the cause. If the checksum or the size does not match, the ZIP file was damaged in transfer; download it again. If the package is built for a newer release of the engine, install the new version of VAMPIRE ABAP first ( chapter 10 ).

The entries do not reach the transport request. In a local package such as $ZSPE_VAMP the entries cannot be transported. In this case import the package ZIP in every system separately ( chapter 9 ).