SAP Mapping Studio
1 · What it does
The SAP Mapping Studio describes where each field of an e-invoice according to EN 16931 gets its value from in SAP. On the left are the fields of the standard, that is the business terms ( BT ) in their groups ( BG ). On the right are the SAP tables and structures with their fields. In the middle you define, for each field of the standard, which table field it comes from and by which rule the value is formed.
The result is a mapping file in JSON format. It describes one document type completely: the header table, the paths to further tables, the repetitions for line items and taxes, and the rule for every field. The Mapping List and the Mapping Diagram open the same file.
The tool works according to these principles:
- It is a single HTML file. You open it in the browser; there is no installation.
- Your data stays in the browser. The tool reads your mapping files and table definitions from your own computer and writes the mapping file back there. It sends no content to a server.
- It does not access SAP. The tool knows the SAP tables only from the table definitions that you give it as JSON files ( chapter 4 ).
The catalogue of the standard is built into the file. It comprises 33 groups, 164 business terms and 59 attributes such as scheme identifiers. Notes on XRechnung are marked with XR at the fields concerned.
Note: The user interface is in German. This manual quotes the labels as they appear on screen and gives their meaning in English in brackets.
2 · Requirements
| What | Requirement |
|---|---|
| Browser | A current browser. Microsoft Edge or Google Chrome are recommended, because only they can remember folders permanently and overwrite a mapping file directly. |
| Table definitions | A folder with JSON files that describe the SAP tables ( chapter 4 ). Without this folder, fields can only be typed by hand, and the selection on the right stays empty. |
| Structure definitions | Optionally a second folder with structures, for example for print program structures with substructures and internal tables. |
This table shows what works in which browser:
| Capability | Edge or Chrome | Other browsers or an embedded preview |
|---|---|---|
| Reading a folder with table definitions | yes | yes |
| Finding the folder again after a restart | yes, after a click on „Zugriff erlauben“ ( allow access ) | no, the folder is chosen again in every session |
| „Speichern“ ( save ) overwrites the opened file | yes | no, the browser downloads the file |
3 · The user interface
The window has a header bar and three columns below it.
| Area | Content |
|---|---|
| Header bar | The name of the mapping, followed by the file name and a dot ● as long as there are unsaved changes. On the right are the indicator „Pflicht … / … fertig“ ( mandatory … / … done ), the switch ◑ for light and dark, and the buttons „Projekt“ ( project ), „Zugriffspfade“ ( access paths ), „Neu“ ( new ), „Öffnen …“ ( open ), „Speichern“ ( save ) and „Speichern unter …“ ( save as ). |
| Left column „EN 16931 · Felder“ | The field tree of the standard with search, filters and legend ( chapter 7 ). |
| Middle column | The editor. It shows the project overview, a field, a group or a document variable, depending on what you have selected. |
| Right column „SAP-Quellen“ | The tables and structures from your folders, with search ( chapter 4 ). |
| Footer | How many fields are mapped, how many access paths exist and how many tables are loaded. |
The indicator „Pflicht … / … fertig“ counts the mandatory fields whose status is „fertig“ ( done ) or „entfällt“ ( not applicable ). It turns green when all mandatory fields are done.
The switch ◑ changes between light and dark display. The browser remembers the choice.
4 · Reading tables and structures
The tool knows no SAP table by itself. It reads the table definitions from a folder that you choose. If you have a table library as a ZIP file, for example sap-tabellen.zip, put it unchanged into the chosen folder. The tool reads the JSON files inside the ZIP as if they lay unpacked in the folder. It cannot read a password-protected ZIP; its files count as skipped.
Choosing folders
The tool reads all files with the extension .json in the folder, including subfolders. In the structure folder every definition counts as a structure. A definition with the entry "kind": "structure" counts as a structure in the table folder as well. Mapping files that lie in the same folder are skipped without a message.
After a restart of the browser, the row shows the remembered folder with the button „Zugriff erlauben“ ( allow access ). A click on it reads the folder again. „Wechseln“ ( change ) chooses a different folder. If you have changed files in the folder, „↻ Neu einlesen“ ( reload ) reads both folders again.
What the right column shows
The tables are sorted into groups, for example „Einkauf (MM)“. As long as you are not searching, the group „Im Kontext“ ( in context ) is shown at the top with the tables that the field can read from directly. A click on a table expands its fields.
| Marker | Meaning |
|---|---|
| ⚿ | The field belongs to the key of the table. |
| green field name | The field is already used in the mapping. |
| „Struktur“ | The source is a structure and not a database table. |
| „Kontext“ | The table is in the context of the selected field. |
| „Pfad“ | The table can be reached via an access path. |
| „Projekt“ | The table is only in the mapping file and in none of the chosen folders. |
In a structure, substructures and internal tables can be expanded further. An internal table is a source of its own with a name of the form STRUCTURE-COMPONENT; it is suitable for repetitions and access paths. If the type of a component is missing from the folders, „fehlt“ ( missing ) appears after it.
The search field „Tabelle, Feld oder Text suchen …“ filters by table names, field names and descriptions.
The format of a table definition
A file contains one table, a list of tables or an object with the entry tables. A table looks like this:
{
"table": "A003",
"text": "Steuerkonditionen: Land / Steuerkennzeichen",
"group": "Einkauf (MM)",
"origin": "SAP-Standard (Auswahl)",
"note": "Pflege über FTXP",
"fields": [
{ "name": "MANDT", "key": true, "text": "Mandant" },
{ "name": "MWSKZ", "key": true, "text": "Steuerkennzeichen" },
{ "name": "KNUMH", "key": false, "text": "Konditionssatz" }
]
}| Entry | Meaning |
|---|---|
table | The name of the table or structure. It is mandatory. |
kind | structure for a structure. Without this entry the definition counts as a table, unless it lies in the structure folder. |
text, group, origin, note | Description, group in the right column, origin and note. Without group, a table is listed under „Kundeneigene Tabellen“ ( customer tables ) and a structure under „Strukturen“. |
fields | The fields. Each field has name and optionally key, dataElement, type, length, decimals and text. |
comp and ref | Only for structures: I includes an include, S is a substructure and T an internal table. ref names the type of the component. |
The Mapping Studio itself does not create table definitions. A new table is created as a new JSON file in this format in the table folder.
5 · Creating, opening and saving mappings
| Button | Effect |
|---|---|
| „Neu“ ( new ) | Starts an empty mapping with the name „Neues Mapping“. |
| „Öffnen …“ ( open ) | Opens a mapping file. You can also drag a mapping file onto the window. |
| „Speichern“ ( save ) or Ctrl+S | Writes the mapping to the file that you last opened with „Öffnen …“ or saved. If there is none yet, the browser asks for the location. |
| „Speichern unter …“ ( save as ) | Always asks for a new location. |
The suggested file name is the name of the mapping with the extension .json. In browsers without direct file access, „Speichern“ downloads the file every time, and the message then reads „Projektdatei heruntergeladen“ ( project file downloaded ).
Every change in the editor takes effect immediately. Only „Speichern“ writes it to the file. As long as there are unsaved changes, the tool asks before „Neu“, before „Öffnen …“ and before loading a dragged file, and the browser warns when the window is closed.
The saved file contains no empty entries. A field without a rule, without a note and with the status „offen“ ( open ) is omitted when saving.
Important: Use „Öffnen …“ for mapping files only. The tool answers a table definition with the message „Das ist eine Tabellendefinition – bitte in den Tabellenordner legen und rechts ↻ klicken.“ ( this is a table definition; put it in the table folder and click ↻ on the right ).
6 · The project overview
The button „Projekt“ shows the overview of the whole mapping in the editor. At the very top is the name of the mapping; you change it directly in this line.
Settings
| Field | Content |
|---|---|
| Szenario ( scenario ) | The document type: SD billing document, MRRL / MRNB ( evaluated receipt settlement ), MRKO ( consignment ), MIRO ( manual credit memo ), FB70 ( FI outgoing invoice ), FB60 ( FI credit memo to vendors ), MRIS ( invoicing plan ), customer or vendor settlement from Settlement Management, other FI document, or other. |
| Kopfquelle ( header source ) | The table or structure from which everything is read, for example VBRK, BKPF or LBBIL_INVOICE. All access paths start here. |
| Beschreibung ( description ) | A free text stating what the mapping is intended for. |
Trigger
The section „Auslöser“ defines which FI documents this mapping produces. „Transaktion“ ( transaction ) compares with BKPF-TCODE, „Referenzvorgang“ ( reference transaction ) with BKPF-AWTYP and „Belegart“ ( document type ) with BKPF-BLART. You separate several values with a comma. An empty document type means all document types. „Hinweis“ ( note ) takes a free text.
Note: With batch input and BAPI postings, TCODE is not always filled. In that case it is better to select the documents via the reference transaction.
Condition control
The section „Konditionssteuerung“ describes how prices, surcharges and discounts, and sub-items get into the invoice. „+ Anlegen“ ( create ) creates it with defaults.
| Field | Content |
|---|---|
| Tabelle ( table ) | The table that holds the treatment per condition type. The default is ZSPE_COND. |
| Anwendung ( application ) | V or M. |
| Vorgabe ohne Eintrag ( default without entry ) | The treatment for price ( KOAID B ), surcharge and discount ( KOAID A ) and tax ( KOAID D ) when the table contains nothing for a condition type. |
| Unterpositionen ( sub-items ) | The field that identifies a sub-item, for example UEPOS, and what happens to it: „merge“ adds it into the main item, „separate“ makes separate invoice lines out of it, „drop“ omits it. |
| Entfällt bei 0 ( omitted at 0 ) | The field, for example PSTYV, and the item categories whose items are omitted with the amount 0. |
The treatments mean: P includes the condition in the price ( BT-146 ), L makes a surcharge or discount at line level ( BG-27 and BG-28 ), H a surcharge or discount at document level ( BG-20 and BG-21 ), X does not output it and S treats it as tax.
The further sections
| Section | Content |
|---|---|
| Belegvariablen ( document variables ) | The values that are determined once per document ( chapter 11 ). „+ Neu“ creates one. |
| Stand ( progress ) | One bar each for mandatory, normal and optional fields. The light part shows the mapped fields, the dark part the finished ones. |
| Offene Pflichtfelder ( open mandatory fields ) | Up to 14 mandatory fields that are not yet done. A click opens the field. |
| Zugriffspfade ( access paths ) | All paths with their route. „Verwalten“ ( manage ) opens the dialogue from chapter 10. |
| Wiederholungen und Gruppenkontexte ( repetitions and group contexts ) | All groups for which a repetition or a context is defined. |
| Quellen ( sources ) | Which folders are chosen and how many tables and structures come from them. Tables that are only in the mapping file are named here. |
7 · Finding fields of the standard
The left column shows the tree of the standard. Groups can be expanded and collapsed; „+“ expands all, „−“ collapses all. After a group are its cardinality and how many of its fields are already mapped. After a field is the short form of its rule.
Classification
Each field has a classification, which a small square in front of the number shows.
| Classification | Meaning |
|---|---|
| Pflicht ( mandatory ) | The field and all groups above it must occur at least once. |
| Normal | The field is not required, but is usually filled. |
| Optional | The field may be missing. |
| Pflicht in Gruppe ( mandatory in group ) | The field becomes mandatory as soon as its group is used. |
The tool determines the classification by itself. You can change it in the field editor: a click on the classification shows a selection with „Automatisch“ ( automatic ), „Pflicht“, „Normal“ and „Optional“. A changed classification is marked with „manuell“ ( manual ).
Status
Each field has a status, which the dot at the end of the line shows.
| Status | Dot | Meaning |
|---|---|---|
| offen ( open ) | empty circle | Nothing exists for the field yet. |
| in Arbeit ( in progress ) | orange | There is a rule, or the status has been set to „in Arbeit“. |
| fertig ( done ) | green | The mapping is complete. |
| entfällt ( not applicable ) | grey | The field is not needed for this document type. |
As soon as you give an open field a source, the tool sets the status to „in Arbeit“. You set „fertig“ and „entfällt“ yourself.
Searching and filtering
The search field „BT-Nummer, Bezeichnung oder SAP-Feld suchen …“ finds fields by their number, their name, their description and the SAP fields in their rule. Below it, the switches „Pflicht“, „Normal“ and „Optional“ show or hide the respective classification. The selection „alle Status“ ( all statuses ) restricts the tree to „offen“ ( open ), „zugeordnet“ ( mapped ), „in Arbeit“ ( in progress ) or „fertig“ ( done ). The switch „Attribute“ shows or hides attributes such as scheme identifiers.
8 · Mapping a field
A click on a field in the tree opens it in the editor. At the top are number, name and description, below them status, classification, cardinality and data type. A note marked XR names a particularity of XRechnung. If it says „Wird beim Erzeugen des XML gesetzt“ ( set when the XML is generated ), the field normally needs no mapping.
The box „Kontext“ shows which row the field reads from. A field at header level reads one row per invoice. A field in a repetition reads per row of the repetition ( chapter 9 ).
Quick mapping by click
For a nested rule, first click „◎ wählen“ ( choose ) in the desired field block. The block then shows „wählt …“ ( choosing ), and at the top of the right column it says „Feld für … wählen – ein Tabellenfeld anklicken“ ( choose field for …; click a table field ). The next click on a table field fills exactly this block. „Abbrechen“ ( cancel ) or the Esc key ends the selection.
The field block
A field block has a selection of the source, the field and optionally a preparation.
| Source | Meaning |
|---|---|
| „Kontext …“ or „über …“ | A table from the context of the field. |
| „Pfad: …“ | A table on an access path. A path from a different repetition is marked with „(anderer Kontext)“ ( other context ). |
| „Freie Tabelle (ohne Zugriffspfad)“ ( free table without access path ) | Any table whose name you type. The tool then points out that an access path is missing. |
The field can be typed; the browser suggests the fields of the table while you type. Below the field are its description with type and length. If it says „Feld nicht in … bekannt“ ( field not known in … ), the table definition does not know this field.
„+ Aufbereitung“ ( preparation ) shows two selections:
| Preparation | Selection |
|---|---|
| Aggregation | Einzelwert ( single value ), erste Zeile ( first row ), Summe ( sum ), Minimum, Maximum, Anzahl ( count ), Liste ( verkettet ) ( list, concatenated ) |
| Conversion | ohne Umsetzung ( none ); Datum → JJJJ-MM-TT ( date to YYYY-MM-DD ); Land → ISO ( T005-INTCA ) ( country to ISO ); Einheit → Rec 20 ( T006 ) ( unit to Rec 20 ); Währung → ISO ( TCURC ) ( currency to ISO ); Vorzeichen aus SHKZG ( sign from SHKZG ); Vorzeichen umkehren ( reverse sign ); Promille → Prozent ( ÷10 ) ( per mille to percent ); führende Nullen entfernen ( remove leading zeros ); Großbuchstaben ( upper case ); Leerzeichen entfernen ( remove spaces ) |
Building rules
Above the value, the rule types are offered. Each block of a rule can in turn contain a rule.
| Rule type | What it does |
|---|---|
| Feld ( field ) | Reads a table field. |
| Konstante ( constant ) | Sets a fixed value, for example 380. |
| Verkettung ( concatenation ) | Joins several parts with a separator. Empty parts are skipped. „+ Teil“ ( part ) adds a part. |
| Berechnung ( calculation ) | Combines two values A and B with an operator: +, -, * or /. |
| Wenn / Dann ( if / then ) | Checks one or more conditions and returns the value under „DANN“ ( then ) or under „SONST“ ( else ). You combine several conditions with „UND (alle)“ ( and, all ) or „ODER (eine)“ ( or, one ). |
| Fallunterscheidung ( case distinction ) | Compares a value with cases. Each case under „WHEN“ names one or more values separated by commas; „WHEN OTHERS“ applies to all others. |
| Funktion ( function ) | Names a function module or a method with parameters and a description of what it returns. |
| Leer ( empty ) | The field is not filled. |
The comparisons in „Wenn / Dann“ are =, <>, <, <=, >, >=, IN for a comma-separated list, CP for a pattern such as DE*, IS INITIAL and IS NOT INITIAL.
If you change the rule type, the tool carries over the previous content where it fits; with „Wenn / Dann“, for example, a field becomes the value under „DANN“. If you change back to the old rule type, the old content returns as well. This applies until you open another mapping or start a new one.
Below the rule, the box „Pseudocode“ shows the rule in a notation close to ABAP. It updates with every input. Under „Notiz“ ( note ) you record notes and open questions. „Zuordnung löschen“ ( delete mapping ) removes the rule, status and note of the field.
Groups
A click on a group shows its classification, its cardinality and the list of its fields. An optional group also has the field „Ausgabebedingung“ ( output condition ) for when the group is generated, for example „nur wenn abweichender Warenempfänger vorhanden“ ( only if a different ship-to party exists ).
9 · Repetitions and group contexts
Line items ( BG-25 ) and the VAT breakdown ( BG-23 ) occur several times in an invoice. For such groups you define a repetition: a path from the header to the table whose rows each produce one entry. For a group that occurs only once you can define a group context; then all fields of the group read from the same row.
Below the steps are three further fields:
| Field | Content |
|---|---|
| Verdichten nach ( aggregate by ) | A field by which rows are combined, for example MWSKZ for totals per tax code. |
| Sortierung ( sorting ) | The field for the order, for example POSNR. |
| Filter / Hinweis ( filter / note ) | A note on which rows apply, for example „nur Hauptpositionen (UEPOS initial)“ ( main items only ). |
„Wiederholung entfernen“ ( remove repetition ) or „Kontext entfernen“ ( remove context ) deletes the definition again.
Conditions in a step
Each condition compares a field of the table of this step with a value.
| Part | Selection |
|---|---|
| Comparison | =, ≠, ist leer ( is empty ), ist nicht leer ( is not empty ), in Liste ( in list ), nicht in Liste ( not in list ), Muster ( pattern ), <, ≤, >, ≥ |
| Kind of value | „Feld aus“ ( field from ) a table before it, „Konstante“ ( constant ), „Variable“ for a document variable, or „Ausdruck“ ( expression ) |
With „ist leer“ and „ist nicht leer“, the condition needs no comparison value. With „in Liste“ you separate the values with a comma, with „Muster“ you write, for example, DE*. If a step with an internal table of the form STRUCTURE-COMPONENT has no condition, the route shows „alle Zeilen“ ( all rows ).
10 · Access paths
An access path describes the route from the header table or a repetition to further tables, for example VBRK → VBPA (PARVW = RE) → KNA1 for the invoice recipient. Fields use a path by its name, for instance „Rechnungsempfänger“ for name, street and city.
The button „Zugriffspfade“ opens the dialogue. On the left are all paths, on the right the details of the selected path.
| Field | Content |
|---|---|
| Name | The name under which fields select the path. |
| Beschreibung ( description ) | A free text, for example „Partnerrolle RE aus dem Beleg“ ( partner role RE from the document ). |
| Ausgangspunkt ( starting point ) | „Kopf“ ( header ), a repetition, or „nach Pfad …“ ( after path ). With the last option, a path starts at the end of another path. |
| Weg ( route ) | The chain of tables with their conditions. |
| Steps | The same editing as for repetitions ( chapter 9 ). |
| Verwendet von ( used by ) | The fields and paths that use this path. |
„+ Neuer Pfad“ ( new path ) creates a path. „Pfad zu … anlegen“ in the field editor creates a path to the typed table, links the key fields and opens the dialogue.
„Pfad löschen“ ( delete path ) asks for confirmation if the path is still in use. After deletion, the affected fields read without a path, and paths that built on it start where it started.
„Fertig“ ( done ), „Schließen“ ( close ), a click beside the dialogue or the Esc key close the dialogue.
11 · Document variables
A document variable is a value that is determined once per document before the access paths run. In conditions of paths and repetitions it serves as a comparison value, for instance the language of the recipient for text tables. In conditions it appears as {{name}}.
„Verwendet in“ ( used in ) names the paths and repetitions that use the variable. „Variable löschen“ ( delete variable ) removes it; conditions with this variable become empty constants.
12 · Keyboard
| Key | Effect |
|---|---|
| Ctrl+S | Saves the mapping. |
| Esc | Closes the dialogue „Zugriffspfade“ or cancels the selection with „◎ wählen“. |
13 · Messages
| Message | Meaning and remedy |
|---|---|
| „Die Datei ist kein gültiges JSON.“ | The file cannot be read. Check whether it is the right file. |
| „Unbekanntes Dateiformat – erwartet wird ein Mapping-Projekt.“ | The file is JSON, but not a mapping file. |
| „Zuerst links ein EN-Feld wählen.“ | You clicked a table field without first selecting a field of the standard. |
| „Die Regel ist verschachtelt – mit ◎ das Ziel markieren.“ | The rule has several blocks. Use „◎ wählen“ to choose which one is to be filled. |
| „Quelle unbekannt – zuerst eine Tabelle oder Struktur aus der Bibliothek eintragen.“ | „Schlüssel verknüpfen“ needs a table that is described in the folders. |
| „Ordner merken geht nur lokal in Edge oder Chrome – hier werden die Ordner je Sitzung eingelesen.“ | The browser cannot remember folders. Choose them again in every session. |
| „… übersprungen“ ( skipped ) next to a folder | This many files in the folder contained no valid table definition. The tooltip names them. |
14 · The demo version
A demo version of the SAP Mapping Studio is available for trying out on einvoice4s.de. It differs from the full version in the following points:
| Point | Demo version |
|---|---|
| Table library | 94 SAP tables are built in and appear as „Demo-Bibliothek“. A folder of your own is not needed. |
| Samples | The selection „Beispiel laden …“ ( load sample ) in the header bar loads one of two finished mappings: „SD-Faktura (VF01)“ or „FI-Ausgangsrechnung (FB70)“. At start-up the first one is loaded. |
| Remembered folders | The demo version does not look for remembered folders at start-up. |
| Footer | The footer names the demo version and the number of built-in tables. |
Everything else works as in the full version: you can edit and save mappings and open your own mapping files. In the demo version, too, your data stays in the browser.
Tip: If you append ?beispiel=fi-fb70 to the address of the demo version, it starts directly with the sample „FI-Ausgangsrechnung (FB70)“.