How to import purchase documents into Wiise

Importing purchase documents: An overview

You’ll need to set up a few things in Wiise before you can import a purchase document. Before you get started, here’s an overview of the steps. 

  • Create the data exchange definition and data exchange type. This is how Wiise imports data, like vendors and items, from an external purchase document, and converts them into a Wiise document. 
  • Set up line and column definitions. Set these up so Wiise knows where to map the imported data and what format it’s in. 
  • Map purchase lines and header lines. This is how you map the data from the columns in each line in the file to the matching fields within Wiise. 
  • Add a data exchange type. Other people can use this data exchange type without having to re-do the data exchange definition. 
  • Import CSV purchase documents. You can do this manually if you want to import a specific document. 
How to create the data exchange definition for purchase documents

The first step is to define the data exchange definition. This is how you import data from external documents (such as purchase orders or invoices) into Wiise. The data, such as items and vendors, must already be set up in Wiise.   

When you create the data exchange definition, you set up the file format (CSV or XML) that’ll be imported. And you set up how the data from the files are mapped to Wiise fields.  The data exchange definition is assigned a data exchange type — this is used to convert the incoming document to the related purchase document into Wiise. 

This example is for a purchase invoice document: 

  1. Search for and select Data Exchange Definitions – Lists, then select +New 
  2. Include the data exchange definition Code — in this case it’s PURCHASE INVOICE CSV 
  3. Include a data exchange definition Name, for example: Purchase Invoice 
  4. Set File Type to Variable Text, and Type to Generic Import 
  5. To include the codeunits that will prompt the import, select Show more 
    • In Data Handling Codeunit, select 1214 
    • In Reading/Writing Codeunit, select 16034400 
  6. In Header Lines, enter 1 to show that the first line in the file consists of header data. This will be left out of the import. 
How to set up Line Definitions for purchase documents

You’ll then need to set up line definitions.  A line definition is simply a row of data fields in your CSV file. This is how you set up the fields from the CSV file so they can map to documents in Wiise.  

Here’s how to set up Line Definitions for vendor details like name and address (the header), and the items ordered or purchased (the lines): 

  1. In the first line of the Line Definitions section, change LINE TYPE to Header, change CODE to HEADER, and then enter a Name
  2. In the second line, change LINE TYPE to Detail, change CODE to LINES, and enter a Name
  3. On the second line, set the PARENT CODE to HEADER
How to set up Column Definitions for purchase documents

Next, you’ll need to set up column definitions. These are simply the data types in the header and line fields in the CSV file. This is how Wiise automatically adds data from the CSV file to your purchase orders or invoices. 

To add Column Definitions for the header and lines from your Line Definitions, follow these steps: 

  1. Highlight the HEADER or LINES in the Lines Definition section. 
  2. In the Column Definitions section, add the information for each of the columns in your CSV file: 
    1. COLUMN NO. (will be the same as the column number in the CSV file)  
    2. NAME of the column 
    3. DATA TYPE (Text, Decimal, Date or DateTime)  
    4. DATE FORMAT (such as dd/MM/yyyy) . 
    5. Set up the language you’ll use in DATA FORMATTING CULTURE, for example: en-AU for Australian. 
  3. Do this first for the HEADER and when you’ve finished, you can repeat the steps for the LINES. 

Note: This data import supports field mapping to both Global and Shortcut Dimensions. 

How to set up other required fields 

You might need extra information that’s not included in your CSV file, like whether the document is an order or an invoice. This information can be set up in column definitions as a CONSTANT

  1. Include a COLUMN NO. that’s not within the CSV file, such as 999.
  2. And include a CONSTANT to ensure it’s captured (the number 3 is used in this example to identify the document type of invoice).
How to map data file columns to purchase docs fields

Now you're ready to map, or cross reference, your data. In this step you'll be mapping the columns and lines to the matching fields in Wiise. And you’ll be using the definitions you've just set up.

You’ll need to complete this twice. Once for the HEADER to map fields to a vendor. And once for the LINES, to the lines of an order, invoice or quote. 

How to map purchase headers 

  1. Highlight the first line definition (HEADER).  Select Manage on the Line Definitions ribbon, then select Field Mapping
  2. Select + to create new entry and then in the General section, set up the mapping like this: 
    1. In Table ID, select 1214  
    2. Tick Use as Intermediate Table 
    3. In Name, type Purchase Header  
    4. Leave both Pre-Mapping Code and Post-Mapping Code blank 
    5. In Mapping Codeunit, select 16034408 (this is for purchase documents) 
    6. In the Field Mapping section, set up which columns map to which fields within Wiise:  
      1. Select the COLUMN NO. from the list of columns created in the How to set up column definitions steps above 
      2. Set the TARGET TABLE ID — this is 38 for purchase header. 
      3. Then finally, in the TARGET FIELD ID, select the Wiise field you want to import to.    
  3. When you’re done, select the back arrow on the top left of the Field Mapping page to exit. 

Note: This data import supports field mapping to both Global and Shortcut Dimensions. 

How to map purchase lines 

  1. Highlight the next line definition (LINES).  Then select Manage on the Line Definitions ribbon, and select Field Mapping
  2. Select + to create new entry and then in the General section, set up the mapping like this: 
    1. In Table ID, select 1214  
    2. Tick Use as Intermediate Table 
    3. In Name, enter Purchase Line 
    4. Leave both Pre-Mapping Code and Post-Mapping Code blank 
    5. In Mapping Codeunit, select 16034408 (this is for purchase documents) 
    6. In the Field Mapping section, specify which columns map to which fields within Wiise.  
      1. Select the COLUMN NO. created in the How to set up column definitions steps above 
      2. Set the TARGET TABLE ID — this is 39 for purchase line. 
      3. Finally, in the TARGET FIELD ID, select the Wiise field you want to import to.   
  3. When you’re done, select the back arrow on the top left of the Field Mapping page to exit. 

Note: This data import supports field mapping to both Global and Shortcut Dimensions.

If you want to import a file with four dimensions, for example, you’d set up four individual column definition lines. You can import up to eight dimension fields including: 

  • A maximum of two global dimensions — these are used as filters on reports and batch jobs. Choose dimensions you’ll use often.  
  • A maximum of six shortcut dimensions — these are found as fields on journal and document lines. 
How to create data exchange types for importing purchase documents

After you’ve completed the data exchange definition and field mapping, you’ll need to add a data exchange type. This is how you identify the data exchange definition you’ve set up. When you import your CSV file, you’ll be prompted to choose a data exchange type. 

Other people in your business can then import purchase orders or invoices using the data exchange types you’ve set up. 

  1. Search data exchange types and select Data Exchange Types — Administration.
  2. Select + to create a new line and fill in the fields on the line like this: 
  • CODE = PURCHCSV  
  • DECSRIPTION = Purchase invoice CSV  
  • DATA EXCH. DEF CODE = PURCHASE INVOICE CSV 
How to import CSV files manually

To import CSV files manually, follow these steps: 

  1. First, choose an Incoming Document
    1. Search for and select Incoming Document 
    2. Select Create from File in the New ribbon tab 
    3. Browse your files to locate and select the CSV file.  
  2. Now select the appropriate Data Exchange Type: 
    1. Open the newly chosen incoming document 
    2. Under the General section, select the appropriate the Data Exchange Type.  
  3. On the ribbon, select Process > Select Document Type and Create 
  4. If there’s a permission error, field mismatch or any other error, you’ll see an Errors and Warnings message.  
      1. If you have to change the setup or data, for example, make the correction and then start Step 3 again.  
      2. If the issue is with the CSV file, you’ll need to correct the error and then start the process again from Step 1
  5.  If the import is successful, you’ll see the incoming document Status will be Created, and the document number will be shown in the Record field.