How to import sales documents into Wiise

You'll need to set up a few things in Wiise before you can import a sales document. Before you get started, here’s an overview of the steps you’ll need to follow. 
  • Create the data exchange definition and data exchange type. This is how Wiise imports data, like customers and items, from an external sales 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 sales 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 sales documents. You can do this automatically by setting up the job queue, or manually if you want to import a specific document. 

How to create the data exchange definition for sales documents

The first step is to define the data exchange definition. This is how you import data from external documents (such as sales orders or invoices) into Wiise. The data, such as items and customers, 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 sales document into Wiise.   

This example is for a sales document with service line items: 

  1. Search and select Data Exchange Definitions – Lists, then select +New 
  2. Include the data exchange definition Code — in this case it’s SALES DOCUMENT CSV 
  3. Include a data exchange definition Name, for example Sales Doc. CSV/Inventory 
  4. Set File type to Variable Text, and Type to Generic Import 
  5. To include the code units that will prompt the import, select Show more: 
    1. In Data Handling Codeunit select 1214 
    2. In Reading/Writing Codeunit select 1214 

 

How to set up Line Definitions for sales documents

You’ll then need to set up line definitions. A line definition is simply a data field 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 customer 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 Detail, change CODE to HEADER, and then enter a name. 
  2. In the second line, change LINE TYPE to Header, 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 sales documents

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

To add Column Definitions for 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 in number the CSV file)  
    2. NAME 
    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 eg en-AU for Australian. 
  3. Do this first for the HEADER and when you’ve finished, you can repeat the steps for the LINES

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 a quote 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) 
How to map data file columns to sales 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 customer. And once for the LINES, to the lines of an order, invoice or quote. 

How to map sales 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:  
    1. In Table ID, and select 1214  
    2. Tick Use as Intermediate Table 
    3. Leave both Pre-Mapping Code and Post-Mapping Code blank 
    4. In Mapping Codeunit, select 16034399 (this is for sales documents) 
    5. 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. The TARGET TABLE ID is 36 for sales header 
      3. Then finally, in the TARGET FIELD ID, select the fields you want to import. 
  3. When you’re done, select the back arrow on the top left of the Field Mapping page to exit.  

How to map sales 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: 
  3. In Table ID, and select 1214 
  4. Tick Use as Intermediate Table 
  5. Leave both Pre-Mapping Code and Post-Mapping Code blank 
  6. In Mapping Codeunit select 16034399 (this is for sales documents) 
  7. In the Field Mapping section, set up 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.  The TARGET TABLE ID is 37 for sales lines 
    3. Then finally, in the TARGET FIELD ID, select the fields you want to import.
  8. When you’re finished, 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 sales 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 sales orders or invoices using the data exchange types you’ve set up. 

  1. Search data exchange types and select Data Exchange Types — Administration 
  2. Now add these lines: 
    • CODE = SALESCSV SALES > DESCRIPTION = Document SALES DOCUMENT CSV and 
    • CODESALESXML SALES > DESCRIPTION = Document SALES DOCUMENT XML 

Note: The Sales CSV DATA EXCH. DEF. CODE has been populated, while the Sales XML type hasn’t. This prevents importing XML files that haven’t been set up. 

How to import sales documents using the job queue

Now, you’re ready to import sales documents. You can do this by setting up the job queue to automatically import CSV files in the incoming document table. 

Here’s how you can set this up automatically using the job queue: 

  1. First, search and select Job Queue Entries 
  2. Then create a job queue entry like this: 
    1. Select +New 
    2. Object Type to run: Codeunit 
    3. Object ID to run: 16034401 
    4. Description: Import Document via Job Queue 
    5. Parameter String: C:\Temp,SALESXML 
  3. The parameter string contains two parameters separated by a comma: Temp,SALESXML 
    1. The first is the folder that’ll be scanned to import the CSV or XML documents 
    2. The second is the Data Exchange Type that’ll be used on the imported documents 
  4. Now set the Recurrence (how often the folder needs to be scanned to import documents) 
  5. In the job queue Status, select Set Status to Ready. When the job queue starts, Wiise will scan the folder and import the files into the incoming document table. And it’ll create the corresponding Wiise documents automatically. 

What are the import limitations? 

Wiise allows you to import several sales and/or purchase documents from a single XML or CSV file.  But Wiise’s standard incoming document feature only allows a one-to-one relationship between a file and a document. You can’t import multiple documents from a single file.  

If you delete a document in Wiise, it will normally reset the corresponding incoming document status to Released. This means that you can create the document in the system from the imported file again. 

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.