EHF – eInvoice for Norway - DAX 2012- setup

Reviewed 31012016

You can use electronic invoicing in Microsoft Dynamics AX for sending electronic invoices to public enterprises in the Official Information Online Universal Business Language (OIOUBL) format – in Norway Electronic HandelsFormat (EHF). The current supported version is EHF 2.0.04.

Very useful document for file format and data on the file:

You can test whether your invoices, credit notes and reminders are in accordance with the requirements of electronic trading format (EHF) at:

Setting up EHF for Norway:

This document includes examples for

A Basic setup EHF

B AIF

C Batch processing

DSetup for company

ESetup for public sector customer

FNotes

  1. Basic setup

Set up the following folder structure in a shared location that can be accessed from the Application Object Server (AOS) computer and from any client computers that are used as batch servers in your system.

  1. Set up the following folder structure for project invoices:

\\Server\EHF\Project\Error

\\Server\EHF\Project\Processed files

\\Server\EHF\Project\Source

\\Server\EHF\Project\Target

\\Server\EHF\Project\XSLT

Set up the following folder structure for sales invoices:

\\Server\EHF\Sales\Error

\\Server\EHF\Sales\Processed files

\\Server\EHF\Sales\Source

\\Server\EHF\Sales\Target

\\Server\EHF\Sales\XSLT


The folders are used as:

Error –Error messages that are generated when the .xml file is converted to the EHF format.

Source –Raw xml-file generated by Microsoft Dynamics AX.

Processed files – Storage for the raw xml-file after the final EHF-file has been generated. The raw xml-file is moved from the Source folder to this folder.

Target – Used to save the final xml-file (this file is send to the access point).

XSLT – Used to save theeSalesInvoice_NO_OIOUBL or eProjectInvoice_NO_OIOUBLfile (style sheet).

  1. In AOT | Resources | Open and export following style sheets to the corresponding location:

File Location

eSalesInvoice_NO_OIOUBL.xsl \\Server\EHF\Sales\XSLT

eProjectInvoice_NO_OIOUBL.xsl \\Server\EHF\Project\XSLT


  1. AIF

Use the Outbound ports form to create an outbound port, set up services and adapters for an outbound port, and specify the Application Integration Framework (AIF) settings that are required to generate Offentlig Information Online Universal Business Language (OIOUBL) electronic invoices.

  1. Click System administration > Setup > Services and Application Integration Framework > Outbound ports.
  2. In the Port name and Description fields, enter a name and a description for the outbound port.

NOTE: you need one port for sales invoices and one for project invoices.

  1. In the Adapter field, select File system adapter.

This adapter is used to create and save the OIOUBL electronic invoices.

  1. In the URI field, specify the location of the Source folder where the raw xml-file is created (ref. the folders setup in point A.).
  1. Click the Service contract customizations FastTab, and then click Service operations.

Select the SalesSalesEInvoiceService.read service operation for sales invoices, or the ProdProjEInvoiceService.read service operation for project invoices, and move it to the Selected service operations list. Close the form.


  1. In the Outbound ports form, select the Customize documents check box, and then click Data policies.
  2. In the Document data policies form, click Enable all to select all XML schema elements (these fields with values are transferred to the raw xml-file; fields not used in the EHF-file can be omitted). Close the form.
  1. Click the Processing options FastTab,
  2. Default encoding format field, select UTF-8.
  3. Mark up Apply value mapping. In the value mapping form, tab page Units, choose Document value External code and the desired Unit code:

  1. Click the Security FastTab, and then in the Restrict to company field, select the company for which the electronic invoices are generated.
  2. Click Activate to use the port to exchange data by using AIF and close the form.
  3. Follow the above steps for setting up outbound port for Project invoices.
  1. Batch processing

You need set up a batch job for sales outbound electronic invoices (here EHFS), and another batch job for project outbound electronic invoices (here EHFP).

The float for sales:

  1. Click System administrationInquiriesBatch jobsBatch jobs.
  2. Press CTRL+N to create a batch job, and then in the Job description field, enter description for the batch job.
  3. Save the batch job, and then click View tasks.

You need to setup three tasks, one per class. The classes used are:

  • AifOutboundProcessingService
  • AifGatewaySendService
  • EInvoiceFileTransform_OIOUBL
  1. In the Batch tasks form, press CTRL+N to create a new batch task (1. Task).
  2. Task description 1
  3. In the Company accounts field, select the company you are creating the batch job for
  4. Class name AifOutboundProcessingService
  5. Choose batch group with selected batch server
  1. CTRL+N to create a new batch task (2. Task).
  2. Task description 2
  3. In the Company accounts field, select the company you are creating the batch job for
  4. Class name AifGatewaySendService
  5. Choose batch group with selected batch server
  6. On the lower pain of the Batch task form, click Ctrl+N and add condition where 1. Task has status Ended (before the selected task, here task 2, can start)

  1. CTRL+N to create a new batch task (3. Task).
  2. Task description 3
  3. In the Company accounts field, select the company you are creating the batch job for
  4. Class name EInvoiceFileTransform_OIOUBL
  5. Choose batch group with selected batch server
  6. On the lower pain of the Batch task form, click Ctrl+N and add condition where 2. Task has status Ended (before the selected task, here task 3, can start)

  1. Still on the 3. Task, click Parameters
  2. In the E-invoice OIOUBL XSL File Transformation form, specify the locations of the Source, Target, Processed, and Error file storage folders. For the XSLT file path, select the path for the eSalesInvoice_NO_OIOUBL file for sales invoices (here EHFS), or the path for the eProjectInvoice_NO_OIOUBL (EHFP) file for project invoices, and click OK.
  3. Close the Batch task form.
  4. On Batch job form, choose Recurrence and define the desired recurrence (for testing purposes 1 minutes works fine).
  5. After batch job setup, choose Functions | Change status and change the status to Waiting
  1. Company setup

The country code for company primary address is NOR in order to enable eInvoice field on the customer setup.

  1. General ledger | Setup | Organization | Legal entities (here GBSI) – Primary address country code NOR for Norway
  1. Company VAT number:
  1. Company Organization number (Routing number):
  1. Company bank account (bank account connected the default method of payment on the public sector customer – the payee’s bank account number)

GBSI/Cash and bank management/Common/Bank accounts (example for testing purposes):

4.1.Method of payment GBSI/Accounts receivable/Setup/Payment/ Method of payments (example)

  1. Sales tax code values

Sales tax code values used in Norway are converted to sales tax (VAT) categories. In order to get the correct categories on the file, the sales tax code values used on the invoice must have the sales tax code value used in Norway.

Rates used as of January 2016 with corresponding VAT categories:

VAT category / Description / Rate % (year 2016)
S / High / 25
H / Medium / 15
AA / Low / 10
E / Excempt / 0
Z / Exempt / 0

Example:

  1. Unit codes

Unit code MUST be coded according to the UN/ECE Recommendation 20; Source:

DIFI EHF Implementation guide

Invoice and Credit note

Version: 2.0.2

Date: August 19, 2014

The code list:

In AX (example; if the unit in AX is pcs, the value used on the file is the external code value; here C62):

GBSI/Organization administration/Setup/Units


  1. Publicsector agency (customer account – required fields)

Choose the desired customer: Accounts receivable > Common > Customers > All customers (here 1000 – Norwegian PS)

  1. In the Customers form, click Edit, and then click the Addresses FastTab to verify that the country/region code, ZIP/postal Code, and street name are entered for the primary address.
  1. Click the Invoice and delivery fastTab and mark the field for eInvoice and ensure the Tax exempt number is filled in with the organization number + MVA.
  1. Click the Payment defaults FastTab, and then in the Method of payment field, select a method of payment for the customer. Company bank account number is fetched from the bank account number on the default method of payment on the customer.
  1. On the Action Pane, click Contacts > Ensure the selected customer has contact setup

IMPORTANT! Customer contact id is taken to the file from the customer contact id – Government ID field.

  1. Notes
  1. Registering invoice, Customer requisition and Reference are recommended:

Example: Free text invoice header

  1. The buyer's accounting code applied to the Invoice Line SHOULD be provided according to EHF. This choice can be done on the invoice header:

And the dimension account on invoice line level:

  1. In order to sent the invoice to batch queue, the invoice must be sent to printer when posting the invoice.

If for any reason the invoice is not set to batch queue, the invoice can be re-sent electronically by choosing invoice journal and Send:

  1. Project invoice

Regulatory Feature (KB3084243)Norway/NOR: Support of project-specific customer references

To comply with business requirements, the following changes have been implemented:

  • The possibility to define default values for "Customer reference", "Customer requisition", "Contact", and "Dimension account".
    A new section "E-invoice" is added in Funding sources of Project contracts where you can define project-specific customer references. Project management and accountingProject Project contracts > (…select a contract) > Funding sources Details (button) > E-Invoice (section).
    Project-specific customer references have higher priority than project contract customer references and will override contract's ones. If no project-specific data is defined or some fields are empty, then related data will be used from contract level (as it worked previously).
    The default customer references can be defined for more than one project.
    The "Line specific" check box is removed from Contract level (for Norway) because you are able now to explicitly define "Dimension account" on Project Invoice Proposal header and lines.
  • The possibility to edit customer references on project proposal level (both header and lines).
    A new section "E-invoice" with customer references is added in Project Invoice Proposal header. This data is filled based on defaults from Projects or from Contracts (according to priorities). You are also able to change it for each proposal individually.
    A new editable field "Order line reference" is added for proposal lines.
    Project management and accounting Project invoicesProject invoice proposals > (…select a proposal) > E-Invoice (section in the header) or Invoice proposal transactions (for lines).
    The "Dimension account" field on Proposal header is read-only. Non-empty "Dimension account" on Proposal header level is shown only it has the same for all the proposal lines. If "Dimension account" values in different proposal lines are different then the "Dimension account" field on Proposal header will be empty.

Described above customer references are used during the generation of electronic invoice output file according to EHF format.

Page 1 of 16