Enterprise Resource Planning Blog Posts by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
V_Krishna_A
Associate
Associate
5,409

What is E-Invoicing

According to the European Commission eInvoicing is the electronic exchange of an invoice document between a supplier and a buyer. An eInvoice is an invoice that has been issued, transmitted, and received in a structured data format which allows for its automatic and electronic processing, as defined in ‘Directive 2014/55/EU’.

Further details the respective country-specific regulations can be found here:

eInvoicing Country Factsheets for each Member State and other countries (europa.eu)

For Germany as an example the following information is currently available:

(…) as of 1 January 2025, eInvoicing becomes the default method to issue invoices in Germany, but they will not be mandated yet for everyone. Businesses must be prepared to receive eInvoice with the EN 16931. However, the supplier is still allowed to issue paper invoices for invoices in unstructured format and non-EN-compliant EDI invoices, as long as buyer’s consent is provided (…).

What is E-Invoicing in the context of SAP Business ByDesign:

SAP Business ByDesign already now supports the exchange of electronic customer invoices and supplier invoices.

In this blog we will focus on the receiving of eInvoices (supplier invoices). We will provide an overview of the existing capabilities, and how to leverage these. In addition, we will outline plans for future releases to better support multiple different eInvoice formats per country.

More details on the sending of eInvoices (customer invoices) can be found in E-Invoicing with SAP Business ByDesign - SAP Community and Integrating SAP Business ByDesign to Peppol Networ... - SAP Community.

How to receive e-invoices in SAP Business ByDesign (supplier invoices):

There are mainly three different options on how to process e-invoices in SAP Business ByDesign:

  • Option 1: Use the standard SOAP service Manage Supplier Invoice In .
  • Option 2: Manual upload of SIV into SAP ByD leveraging transformation IDs.
  • Option 3: Automated upload of SIV into SAP ByD leveraging transformation IDs.

DISCLAIMER : The blog primarily is a direction for the partners/customers on how to achieve e-invoicing. Request partner/customer user to adopt their XMLs as needed, by referring to this blog as just an example.

In the following we will have a deeper look into these options:

Option 1:  Use the Manage Supplier Invoice In inbound SOAP service. In this approach an external or partner solution needs to do the processing of the eInvoicing XML as well as content mapping from the respective eInvoicing format into the format / payload requested by the SOAP service.

Mainly the operation Maintain_Bundle operation of the Manage Supplier Invoice In inbound service interface is relevant. For more details please refer to the service “Manage Supplier Invoice In”  SAP help documentation .

*******

Option 2: Manual upload of SIV into SAP Business ByDesign leveraging transformation IDs.

Note: Sample XML files of Supplier invoice & transformation files are provided at the end of this blog. 

Detailed Steps:

(1) First you need to enhance your scope to allow the creation of supplier invoices via file upload. This can be done in the ‘Questions’ section in business configuration under

  • Scoping element ‘Purchasing – Supplier Invoice – Supplier Invoices and Credit Memos’
  • Select the business option ‘Do you want to enter supplier invoices via file upload?’.

 

(2) In addition, you must assign the ‘Invoice File Upload’ view of the ‘Supplier Invoicing’ work center to the respective users.

Picture2.png

(3) Next, go to the ‘Supplier Invoicing’ – view ‘Invoice File Upload’ and execute the ‘Upload’ action.

Picture3.png

(4) In the popup specify the country of the invoice, the transformation data, as well as the transformation ID. Once this is provided, by executing the action ‘Start Process’ immediately supplier invoices will be created from the uploaded files (action ‘+ Browse’).

Picture4.png

In the following we will describe in detail how to define a transformation ID. (if you already have transformation ID, then please proceed to point (5))

First, we need to give some background on transformations. E-Invoices are provided in a certain XML format provided by the government. A transformation now uses a so-called ‘Extensible Stylesheet Language Transformations (XSLT)’ file to convert the original XML format into the SAP Business ByDesign specific XML format.

That means, in case a transformation is available, the system can then automatically process the uploaded XML and create a supplier invoice in SAP Business ByDesign. SAP will not provide these transformations out-of-the-box, however customers or partners can easily create and upload their transformations. In the next section we will therefore provide the detailed steps on how to create the transformation together with examples that you can use as a starting point.

Steps to create a transformation ID:

  • Navigate to the ‘Business Configuration’ work center – view ‘Overview’
  • Under ‘Business Configuration Search’, search for ‘Common Master Data Configuration’ and click on the activity.

Picture5.png

  • In the ‘Common Master Data – Configuration for Variants’ UI select the line with the ‘Configuration Type Code’ being ‘Transformation Repository’ and execute the action ‘Edit’.

Picture6.png

  • Here you find a list of transformations for different types (business scenarios) per country.
  • Add a new row with
    • A reasonable transformation name
    • Transformation Type “SIV - XSL Transformation Supplier Invoice”
    • Tranformation SubType “NOSUB - Subtype not required”
    • And the country for which the transformation type is valid, if you don’t select a country, the transformation type will be valid for all Countries.
  • Set the status to ‘Active’.
  • In the ‘Transformation Version’ section create a new row with
  • a reasonable description
  • the validity dates for the transformation

Picture8.png

  • In the section ‘XSL Transformation File
  • Add an XSL transformation file by using the ‘Add’ action. We will provide an example transformation file together with an example eInvoice XML at the end of this blog post.
  • Set the status to ‘Active’.
  • Click on Save and make sure that the system has successfully created a transformation. You can check this in the “Deployment Logs” section. 

Picture8.png

Note: currently we support only one transformation sub-type (NO-SUBTYPE). Consequently, only one transformation can be maintained per country to process supplier eInvoice XML files. Nevertheless, we currently investigate in allowing multiple sub-types. Once we have more clarity on that we will update this blog post accordingly. This would allow us to process multiple different eInvoice formats per country in parallel.

(5) Now that the transformation ID got created, we can continue in the work center ‘Supplier Invoicing’, view ‘Invoice File Upload’, action ‘Upload’. Here we now find our newly created ‘Transformation ID’ in the popup value help.

(6) By executing ‘+ Browse..’ you can add eInvoice files.

Picture9.png

(7) Execute the action ‘Start Process’ to finally uploading the selected files, transform them using the selected transformation ID, and to create supplier invoices in SAP Business ByDesign.

*******

Option 3: Automated upload of SIV into SAP ByD leveraging transformation IDs.

To do so first you have to follow all the steps as shown in Option 2, except the last step of manually uploading the SIV eInvoicing XML through workcenter “Invoice File Upload”. The manual step of SIV upload is automated through the call of the Odata service “scannedinvoicestagingodata”.

Note: the sample Postman Collection and postman environment can be found in public git repository Supplier E-Invoicing Postman Collection : 

Detailed steps to automate SIV upload through Odata service “scannedinvoicestagingodata”:

  • Step 1: get the CSRF-token which is used for POST service call in the next step ( note: the x-csrf-token is fetched via the GET service call
    • Sample GET odata call looks like: https://{{TenantHostname}}/sap/byd/odata/v1/scannedinvoicestagingodata/ScannedInvoiceStagingObjectCollection
    • http-header parameter x-csrf-token=fetch to get the CSRF-token in the next POST call.

 

  • Step 2: Create Scanned Invoice Staging Object , in this step via POST odata call you can create the instance of scanned invoice staging object.
    • Sample POST odata call looks like: https://{{TenantHostname}}/sap/byd/odata/v1/scannedinvoicestagingodata/ScannedInvoiceStagingObjectCollection
    • with the http-header parameters
      • Content-Type = application/json
      • x-csrf-token = <as provided by the response header in step 1>
    • and sample json in body:
    • From the odata response call, copy the ObjectID (<d:ObjectID>{{ Scanned Invoice Staging Object }}</d:ObjectID>), to be used in next step as ParentObjectID

 

 

 

 

 

 

 

 

{
	"FileName": "{{SIV-Einvoice-FileName}}",
	"TransformationDate": "{{SIV-XSLT-TransformationDate}}",
	"TypeCode": "02",
	"CountryCode": "DE"
}

 

 

 

 

 

 

 

 

  • Step 3: Create Attachment instance , in this step via POST odata call you can create the instance of SIV document as BLOB attachment linked to earlier created scanned invoice staging object in earlier step.
    • Sample POST odata call looks like:
    • https://{{TenantHostname}}/sap/byd/odata/v1/scannedinvoicestagingodata/ScannedInvoiceStagingObjectAttachmentFolderCollection
    • with the http-header parameters
      • Content-Type = application/json
      • x-csrf-token = <as provided by the response header in step 1>
    • and sample json in body:

 

 

 

 

 

 

 

 

{
	"ParentObjectID": "{{ScannedSIVObjectID}}",
	"Name": "{{SIV-Einvoice-FileName}}",
	"MimeType": "application/xml",
    "TypeCode": "10001",
	"CategoryCode": "2",
	"Binary": "{{SIV-Einvoice-BLOB}}"
}

 

 

 

 

 

 

 

 

Note : you have to create an BLOB (Binary Large Object) using the external tools like https://onlinexmltools.com/convert-xml-to-base64 and remove the new lines using the tools https://www.textfixer.com/tools/remove-line-breaks.php , copy the resultant BLOB as input to "Binary": {{ input SIV XML BLOB }} to make the above POST odata service call. 

Note: please use any open source tools to create BLOB , above mentioned tools are just an example.

  • Step 4: Process SIV , in this step via POST odata call you initiate the creation of SIV document in the system using the SIV xml uploaded in earlier step.
    • Sample POST odata call looks like:
    • https://{{TenantHostname}}/sap/byd/odata/v1/scannedinvoicestagingodata/processFile?ObjectID='{{ScannedSIVObjectID}}'
    • with the http-header parameters
      • Content-Type = application/json
      • x-csrf-token = <as provided by the response header in step 1>
    • Note : out come of the step would be the creation of SIV in system. The same can be verified in UI by navigating to “Supplier Invoicing” -> “Invoice File Upload”

Please find below the sample Supplier eInvoice XML:

 

 

 

 

 

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<ubl:Invoice xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
             xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
			 xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
             xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
    <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</cbc:CustomizationID>
    <cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
    <cbc:ID>EXTPOREF1963</cbc:ID>
    <cbc:IssueDate>2024-10-21</cbc:IssueDate>
    <cbc:DueDate>2024-10-22</cbc:DueDate>
    <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
    <cbc:BuyerReference>99000000-01514-29</cbc:BuyerReference>
    <cac:OrderReference>
        <cbc:ID>1963</cbc:ID>
    </cac:OrderReference>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cbc:EndpointID schemeID="EM">seller@seller.com</cbc:EndpointID>
			<cac:PartyIdentification>
				<cbc:ID>S200100</cbc:ID>
			</cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>Eichbaumer Consulting</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>Geibelstraße 3</cbc:StreetName>
                <cbc:CityName>Celle</cbc:CityName>
                <cbc:PostalZone>29223</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>DE</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID>DE123456789</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>Eichbaumer Consulting</cbc:RegistrationName>
                <cbc:CompanyID>123/456/7890</cbc:CompanyID>
                <cbc:CompanyLegalForm>123/456/7890, HRA-Eintrag in Celle</cbc:CompanyLegalForm>
            </cac:PartyLegalEntity>
            <cac:Contact>
                <cbc:Name>Gerd Lieferant</cbc:Name>
                <cbc:Telephone>+49 1234-5678</cbc:Telephone>
                <cbc:ElectronicMail>gerd.lieferant@seller.com</cbc:ElectronicMail>
            </cac:Contact>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
        <cac:Party>
            <cbc:EndpointID schemeID="EM">byd@buyer.com</cbc:EndpointID>
            <cac:PartyIdentification>
                <cbc:ID>1000</cbc:ID>
            </cac:PartyIdentification>
            <cac:PartyName>
                <cbc:Name>Almika</cbc:Name>
            </cac:PartyName>
            <cac:PostalAddress>
                <cbc:StreetName>Rechnungssstrasse 191</cbc:StreetName>
                <cbc:CityName>Hannover</cbc:CityName>
                <cbc:PostalZone>30451</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>DE</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>Almika</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingCustomerParty>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode>58</cbc:PaymentMeansCode>
        <cac:PayeeFinancialAccount>
            <cbc:ID>DE75512108001245126199</cbc:ID>
        </cac:PayeeFinancialAccount>
    </cac:PaymentMeans>
    <cac:PaymentTerms>
        <cbc:Note>Zahlbar sofort ohne Abzug.</cbc:Note>
    </cac:PaymentTerms>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="EUR">42.18</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="EUR">222.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="EUR">42.18</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>19</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="EUR">222.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="EUR">222.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="EUR">264.18</cbc:TaxInclusiveAmount>
        <cbc:PayableAmount currencyID="EUR">264.18</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>1</cbc:ID>
        <cbc:Note>Junior Consulting</cbc:Note>
        <cbc:InvoicedQuantity unitCode="h">1</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="EUR">222.00</cbc:LineExtensionAmount>
        <cac:OrderLineReference>
            <cbc:LineID>1</cbc:LineID>
        </cac:OrderLineReference>
        <cac:Item>
            <cbc:Description>Junior Consulting</cbc:Description>
            <cbc:Name>Junior Consulting</cbc:Name>
            <cac:BuyersItemIdentification>
                <cbc:ID>S200102</cbc:ID>
            </cac:BuyersItemIdentification>
            <cac:SellersItemIdentification>
                <cbc:ID>S200102</cbc:ID>
            </cac:SellersItemIdentification>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>19</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="EUR">222.00</cbc:PriceAmount>
			<cbc:BaseQuantity unitCode="h">1</cbc:BaseQuantity>
        </cac:Price>
    </cac:InvoiceLine>
</ubl:Invoice>

 

 

 

 

 

 

 

 

 

 

Please find below the Sample XML transformation (XSLT):

 

 

 

 

 

 

 

 

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" version="1.0">
  <xsl:output encoding="UTF-8" indent="yes" method="xml"/>
  <xsl:strip-space elements="*"/>
  <xsl:template match="/">
    <n0:SupplierInvoiceBundleMaintainRequest_sync xmlns:n0="http://sap.com/xi/SAPGlobal20/Global" xmlns:prx="urn:sap.com:proxy:ACL:/1SAI/TASCBE832EAAD015B6BD1A8:804">
      <BasicMessageHeader>
      </BasicMessageHeader>
      <SupplierInvoice>
        <BusinessTransactionDocumentTypeCode>004</BusinessTransactionDocumentTypeCode>
        <CustomerInvoiceReference actionCode="01">
          <BusinessTransactionDocumentReference>
          <ID>
          <xsl:value-of select="/ubl:Invoice/cbc:ID"/>
          </ID>
          <TypeCode>28</TypeCode>
          </BusinessTransactionDocumentReference>
        </CustomerInvoiceReference>
        <DocumentItemGrossAmountIndicator>false</DocumentItemGrossAmountIndicator>
        <GrossAmount>
          <xsl:value-of select="/ubl:Invoice/cac:LegalMonetaryTotal/cbc:PayableAmount"/>
        </GrossAmount>
        <Date>
          <xsl:value-of select="/ubl:Invoice/cbc:IssueDate"/>
        </Date>
        <BuyerParty actionCode="01">
          <PartyKey>
          <PartyTypeCode>200</PartyTypeCode>
          <PartyID>
          <xsl:value-of select="/ubl:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyIdentification/cbc:ID"/>
          </PartyID>
          </PartyKey>
         </BuyerParty>
        <SellerParty actionCode="01">
          <PartyKey>
          <PartyTypeCode>147</PartyTypeCode>
          <PartyID>
          <xsl:value-of select="/ubl:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification/cbc:ID"/>
          </PartyID>
          </PartyKey>
        </SellerParty>
        <Item actionCode="01">
          <ObjectNodePartyTechnicalID>15</ObjectNodePartyTechnicalID>
          <BusinessTransactionDocumentItemTypeCode>002</BusinessTransactionDocumentItemTypeCode>
          <Quantity>
            <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cbc:InvoicedQuantity"/>
          </Quantity>
           <QuantityTypeCode>
            <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cbc:InvoicedQuantity/@unitCode"/>
          </QuantityTypeCode>
          <Item_Description>
            <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cac:Item/cbc:Name"/>
          </Item_Description>
          <NetAmount>
            <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cbc:LineExtensionAmount"/>
          </NetAmount>
          <NetUnitPrice>
            <Amount>
              <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cac:Price/cbc:PriceAmount"/>
            </Amount>
            <BaseQuantity>
              <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cac:Price/cbc:BaseQuantity"/>
            </BaseQuantity>
            <BaseQuantityTypeCode>
                <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cac:Price/cbc:BaseQuantity/@unitCode"/>
            </BaseQuantityTypeCode>
          </NetUnitPrice>
          <Product actionCode="01">
            <ObjectNodeSendertechnicalID></ObjectNodeSendertechnicalID>
            <CashDiscountDeductibleIndicator>true</CashDiscountDeductibleIndicator>
            <ProductKey>
              <ProductTypeCode>1</ProductTypeCode>
              <ProductIdentifierTypeCode>1</ProductIdentifierTypeCode>
              <ProductID>
                <xsl:value-of select="/ubl:Invoice/cac:InvoiceLine/cac:Item/cac:SellersItemIdentification/cbc:ID"/>
              </ProductID>
            </ProductKey>
          </Product>
        </Item>
      </SupplierInvoice>
    </n0:SupplierInvoiceBundleMaintainRequest_sync>
  </xsl:template>
</xsl:transform>

 

 

 

For a template file, which has the mapping for majority of key fields, pls refer to this blog

https://community.sap.com/t5/enterprise-resource-planning-blogs-by-sap/german-xrechnung-template-for... 

 

 

 

 

 

6 Comments