Mapping
This page explains, in business terms, how an SAP INVOIC02 IDoc is interpreted and turned into a UBL invoice (for example Peppol BIS Billing 3.0).
The tables below are written as “business fields → where they come from in IDoc → where they end up in UBL”:
- The left bullet in each row is the target UBL XPath (what the final business document contains).
- The right bullet is the source IDoc XPath (where the value is read from in the INVOIC02 XML).
- The text after the list describes the mapping logic (qualifiers, parsing rules, limitations).
How to read an IDoc (why qualifiers matter)
INVOIC02 uses short segment names, and the meaning is usually defined by a qualifier:
E1EDK02/QUALF: the type of reference (invoice number, PO number, delivery note, preceding invoice, …).E1EDK03/IDDAT: the type of date (due date, delivery date, …).E1EDKA1/PARVW: the partner role (supplier, buyer, ship-to, contact, …).E1EDS01/SUMID: the type of total (tax total, net subtotal, gross/payable total, …).
Because of this, the conversion is not a simple 1:1 “tag rename”: the mapping must first pick the right segment instance (by qualifier) and then apply any parsing/normalization needed to match the UBL business model.
Amounts, taxes, allowances and charges (standard mapping behaviour)
This section describes how INVOIC02 segment groups relate to UBL amounts and taxes in the standard integration. Values are taken as SAP sends them; the mapping does not recompute tax from rate × base or reconcile line totals to header totals.
Line amounts (E1EDP01 → E1EDP26)
For each line, E1EDP26 rows are read by QUALF:
QUALF='001'→ unit price. The amount inBETRGis normalised with no minus sign on the price (unit price is always positive in the output model).QUALF='002'→ line net / extended amount (subtotal).BETRGis normalised for negative amounts: if the string contains-, it is reduced to at most one leading minus and stray minus signs are removed from the numeric part (SAP sometimes encodes negatives with repeated-characters).
So: price is always non-negative after mapping; subtotal may be negative after normalisation.
Line tax (E1EDP04)
From the line tax segment:
MSATZ→ tax rate (percent) as a string.MWSBT→ tax amount for the line, using the same negative-amount normalisation as for line subtotals.MWSKZ→ SAP tax code. It is mapped to a UBL / Peppol tax category id (E,S,Z,AE, …) using a fixed lookup table; if the code is not in the table, the category defaults toZ.
If the line tax amount is negative, the mapping treats the line as a credit-style line: quantity (MENGE) is prefixed with - while the unit price stays positive (only the subtotal/tax side carries the credit).
Allowances and charges at line level (E1EDP05)
Each E1EDP05 row is a condition (discount, surcharge, etc.):
- Filter by text: rows whose
KOTXTis exactlyBruttoor contains the substringGrossare skipped (those rows are treated as gross/total helpers, not separate allowances/charges for this mapping). - For each remaining row,
ALCKZsets the direction:-→ discount,+→ charge. BETRGis the absolute amount of that condition. Each condition is recorded in full; summary discount and charge amounts used for some totals are overwritten on each matching row, so only the last non-filtered discount and the last non-filtered charge appear in those summaries. The full list of conditions remains available at line level.
No separate step derives “net before discount” from gross: subtotal and tax come from E1EDP26 / E1EDP04, while discount/charge are parallel amounts from E1EDP05.
Document totals (E1EDS01)
Summary segments use SUMID to choose the meaning of SUMME:
SUMID |
Role in UBL totals |
|---|---|
005 |
Tax total (aligned with tax line totals) |
010 |
Net subtotal (aligned with line net totals) |
012 |
Payable / gross total and balance |
Amounts are taken as strings from SUMME without further arithmetic.
Tax subtotals by rate (document level)
For document-level tax breakdown, the standard mapping aggregates per tax category and percent from the lines: it starts from each line’s net subtotal, adjusts the taxable base by subtracting line-level discount and adding line-level charge where applicable, and accumulates line tax amounts into the buckets. That drives the header-level tax breakdown in UBL—it is not a recomputation from SAP’s header tax segment alone.
Parties and endpoint IDs (E1EDKA1/PARVW)
Partners are read from E1EDKA1 by PARVW:
PARVW='RS'→ supplier / invoice issuer →cac:AccountingSupplierPartyPARVW='RE'→ buyer / customer →cac:AccountingCustomerPartyPARVW='WE'→ ship-to / delivery →cac:Delivery/*PARVW='ZX'→ supplier contact → supplier contact fields and supplier endpoint ID
A fixed set of IDoc fields is mapped from each selected E1EDKA1 instance. Some UBL address or contact elements (e.g. region sub-entity, a third address line, contact email) may be empty if your IDoc does not populate the corresponding segment fields or the mapping does not cover them.
Endpoint IDs are not taken from a separate SAP segment; they are derived from STRS2 with simple string rules:
- Supplier endpoint ID: from the contact partner (
PARVW='ZX') fieldSTRS2. - If
STRS2contains:→ split intoschemeID:value(left →@schemeID, right → value). - If there is no
:→ no endpoint from this rule. - Buyer endpoint ID: from the buyer partner (
PARVW='RE') fieldSTRS2. - If
STRS2contains:→ split intoschemeID:value(same as supplier contact). - Else if
STRS2contains@→ the entire string is the endpoint value (no scheme parsed).
Header |
|---|
Invoice Number
QUALF='009'. |
Invoice Issue Date (Date Created)
YYYYMMDD → UBL YYYY-MM-DD. |
Invoice Due Date
YYYYMMDD → UBL YYYY-MM-DD. Mapped only for IDDAT='028'. |
Invoice Type Code
BSART='CRME' → UBL 384 (credit note). If BSART='INVO' and E1EDK14[QUALF='015']/ORGID ∈ {ZMA,ZMV} → 326, otherwise 380. |
Currency Code
CURCY. |
Buyer Reference (Client Reference)
STRS2 contains : → take the part after :. If missing/empty → buyer reference is not mapped. |
Invoice Terms / Note
E1EDKT2 is taken from the IDoc. The note text may carry a standard processing prefix before the free text. |
Invoice Payment ID / Payment Description
|
Accounting Cost (Invoice level)
|
Invoice Period Start Date
|
Invoice Period End Date
|
Invoice Period Description Code (Tax point date code)
|
Tax Currency Code
|
Tax Point Date
|
Payment Terms (Text)
QUALF='005'. |
Order Reference (Purchase Order)
QUALF='001'. |
Sales Order Reference
QUALF='002'. |
Contract Reference
|
Project Reference
|
Originator Reference (Award / OriginatorDocumentReference)
|
Despatch Advice Reference
|
Receipt Advice Reference
|
Additional Document Reference: Object Reference (DocumentTypeCode=130)
QUALF='012' supplies the referenced document number. In UBL this appears as cac:AdditionalDocumentReference with cbc:DocumentTypeCode=130 and identifier scheme DQ on cbc:ID. |
Additional Document Reference: ID scheme
QUALF='012', the identifier scheme in UBL is DQ (there is no separate scheme field in the IDoc for this reference). |
Additional Document Reference: Document Description
|
Additional Document Reference: External URI
|
Additional Document Reference: Embedded content (base64)
|
Preceding Invoice Reference (BillingReference / InvoiceDocumentReference)
QUALF='031' / BELNR. The preceding invoice date is not mapped from the IDoc in the standard integration. |
Parties mapping explanation |
Supplier Name (RegistrationName)
PARVW='RS'). |
Supplier Company Legal Form / Description
NAME4 of the supplier partner. |
Supplier Trade Name
NAME4 when used as trade / second name; semantics depend on your SAP data. |
Supplier Street
|
Supplier Additional Street
STRS2 is overloaded and can also carry codes using :; use it as an address field only if there is no : / by explicit agreement. |
Supplier Address Line 3
|
Supplier City
|
Supplier Postal Code
|
Supplier Country Subentity
|
Supplier Country Code
|
Supplier Party Identifier (CompanyID)
|
Supplier Endpoint ID (Org PEPPOL ID)
PARVW='ZX': if STRS2 contains : → left part → @schemeID, right part → value. |
Supplier VAT ID
E1EDK01/EIGENUINR. |
Customer Name (RegistrationName)
PARVW='RE'). |
Customer Trade Name
|
Customer Street
|
Customer City
|
Customer Postal Code
|
Customer Country Code
|
Customer Party Identifier (CompanyID)
|
Customer Endpoint ID
STRS2: if it contains : → split into scheme and value; if it contains @ → whole string is the value (no scheme). |
Customer VAT ID
E1EDK01/KUNDEUINR. |
Customer Contact Name
TELF1 on the buyer partner; confirm with your SAP partner master whether this is contact name or phone. |
Customer Contact Email
|
Supplier Contact Name / Phone / Email
PARVW='ZX' partner exists. |
Supplier Contact Phone
|
Supplier Contact Email
NAME3 on the PARVW='ZX' contact partner (common project convention). |
Delivery mapping explanation |
Delivery Location ID
PARVW='WE'): PARTN maps to the delivery location identifier value. @schemeID is not taken from the IDoc in the standard integration. |
Delivery Street
|
Delivery Additional Street
NAME2 of the delivery partner. |
Delivery Address Line 3
NAME3 of the delivery partner. |
Delivery City
|
Delivery Postal Code
|
Delivery Country Subentity
|
Delivery Country Code
|
Delivery Party Name
|
Payment means mapping explanation |
Payee Account IBAN
E1EDK28 → one PaymentMeans. |
Payee Bank BIC
|
Invoice lines / items mapping explanation |
Invoice Line ID / Position
|
Invoice Line Note
|
Invoiced Quantity
MENEE; optional unit-code mapping may be applied for target validation rules. |
Base Quantity
|
Item Seller ID
QUALF='002'. |
Item Buyer ID
|
Item Name
QUALF='002'. |
Item Standard ID
QUALF='003'. |
Item Standard ID Scheme
|
Item Tax Percent
MSATZ. |
Item Tax Amount (Line Tax Total)
- characters). |
Item Tax Category Code
A0,A2→E, A3,19→S, A6,B2→Z, A9,B3→AE, otherwise Z. |
Item Price Amount
|
Gross Price / AllowanceCharge on Price
|
Line Extension Amount (Item Subtotal)
|
Line Allowance/Charge (Discount/Charge)
ALCKZ='-' → discount, ALCKZ='+' → charge. Mapped only if KOTXT != 'Brutto' and does not contain Gross. |
Item Description (Text lines)
\n line breaks between TDLINE values. |
Order Line Reference (LineID)
|
Item Document Reference
|
Item Document Reference Type Code
|
Item Accounting Cost
|
Item Period Start Date
Leistungsdatum: dd.mm.yyyy is present (conversion dd.mm.yyyy → YYYY-MM-DD). |
Item Period End Date
Leistungsdatum: dd.mm.yyyy is present (conversion dd.mm.yyyy → YYYY-MM-DD). |
Item Origin Country Code
|
Item Commodity Classification
|
Item Properties (Free-form)
Position: X → groups sublines; Lieferschein: X → property (Name=Lieferschein); Reparaturvorgang: X → property; Gerätebezeichnung: X → property; Leistungsdatum: dd.mm.yyyy → period start/end (conversion dd.mm.yyyy → YYYY-MM-DD). |
Sub Invoice Line (Aggregated)
Position: X property line (TDID Z007); there is no direct IDoc segment for sublines. |
Totals mapping explanation |
Invoice Tax Total
SUMME where SUMID='005' (tax total; also aligned with summed line taxes). |
Invoice Subtotal (Tax Exclusive Amount)
SUMME where SUMID='010' (net subtotal). |
Invoice Total (Tax Inclusive Amount) / Balance
SUMME where SUMID='012' (gross / payable). |
Allowance Total Amount
SUMID values 005, 010, and 012. |
Charge Total Amount
|
Prepaid Amount
|
Payable Rounding Amount
|