NAV 2016 Data Exchange – file import

As promised it is time to pick more things that I have improved for NAV 2016.  Still on the Data Exchange, and looking at file import.  We can import a text file; fixed and delimited, with different encoding.

By using Codeunit 1240 for the External Data Handling action we are able to get any text file into the Data Exchange framework.  It will simply prompt the user for a local file name.

Microsoft shipped Codeunit 1241 to read a flat file.  I decided to change that a bit with two enhancements.  First, I wanted to be able to read a delimited file and second, I wanted to be able to use different encoding.

The Codeunit name is “Fixed File Import” and just the name change show the difference.  My version is named “Fixed/Delimited File Import”.

There are settings in the Data Exchange that I wanted to be able to support.


The standard Codeunit only reads the MSDOS File Encoding with this code


to read the four different text encoding that are supported by the Data Exchange Setup.

The PharseLine section in the standard Codeunit has this simple loop to read the fixed file.

Extending this and adding two functions gives me the ability to import both fixed and variable text file.

More to come.  Stay tuned…


17 Replies to “NAV 2016 Data Exchange – file import”

  1. Have a look at the XMLport 1220 (Data Exch. Import – CSV) – it supports variable text length and all the different DataExchange Encodings

  2. I am wanting to use data exchange definitions for certain integrations of Sales Orders. There is a Generic Import type (used by PEPPOL invoice for example) but no Generic Export type. Should data exchange definition be able to export other things apart from Bank Statement and if so why is there no type available.

  3. Any way to handle dimensions in the import.
    I need to import into the General Journal, and i have several shortcut dimensions that i have to import.

  4. Thank you very much!This is only blog I could found about Data Exchange Definitions…Any suggestions how to handle .txt import with more than one line?one header and two detail?

  5. Hi Gunnar, Is there any function to ”skip line” when importing if the value of a colum = certain value? I want to Skip all transaction with status = Declined for example.

    Thank you

  6. Hi Gunnar,

    is it possible to convert data via the Data Exchange Framework?
    For example an export from another financial system, which uses different G/L accounts into NAV. A conversion table could map the G/L accounts from the first system with the NAV G/L account.

    1. Hi Marc.
      That would be done using a pre- or post-mapping codeunit. Pre-mapping to change the data in data exchange before creating the result data. Post-mapping to update the result data after import.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.