次の方法で共有


Axapta Document Management

I've recently become involved in testing the Document Management features in Axapta.  This is a pretty powerful subsystem for integrating external structured and unstructured data and document types with the in built ERP system.

 There are two sides of document management... the end-user aspect and the administrator or setup side of it.  Ultimately what you want is to give your end users a better experience; I'll mostly be talking about the sorts of documents you can setup using the administration side of things.

User Overview of Attaching Documents 

To get a quick look at doc handling in Axapta, open up AR->Customers.  Next to the big "bell" icon (the Alerts button, if you're using 4.x) there will be an icon that looks like a document.  If you mouse-hover (in 4.x, at least) over the button it will say "Document handling"

If you click this button you get the Document Handling form (DocuView). 

DocuView is an app-singleton form.  That means that you can only have one instance of it open at a time.  Since you open DocuView from some other form, you are operating on a linked data source (that is, the DocuView form knows who called it, and restricts its data to the context-appropriate records).  In our case, you'll see the documents attached to whatever customer was selected when you hit the doc handling button.

If you're new to doc handling, you'll probably have an empty grid.    Off on the right you'll see a "New" button.  Axapta has some in-built document types; the most commonly used one is "Note".  Select New->Note.  You'll be able to enter a description, and then set the flag "Internal" or "External".  Finally, in the window at the bottom of the DocuView form you'll be able to enter free form text.

hit ctrl-S to save the note.  You've now attached a document to this customer.

Administrator view of Setting up Document Types 

Now, you may have noticed other options available to you under New->.  On my configuration, one of them is "Letter". 

Axapta has the ability to create Word documents for you with data pre-populated.  Here we begin to talk about the Setup side of things.

In Basic->Setup->Document Management->Document Types, you'll find the configuration of the document types available in Doc handling. 

You can create new records here.  Give your new document type a name like "CustLetter".  The "Job description" property is most interesting.  Here we'll choose from the drop down "Create Word document via COM".

Switch over to the general tab and make sure to set the "Archive directory".  Then click "Options" on the right.

Mapping Axapta Table Fields to Document Template Bookmarks

The new form that opens is how you bind Axapta data to the document type.  Here you'll define what data to export into the Word document, and how it will be mapped into the document.

Hit Ctrl-N to setup a new table mapping.  Choose the table you'd like to pull data from (CustTable is a fine choice). 

Here we're going to use a Word Template. 

Suppose I've got a word document that is a nice form letter I'd like to send customers.  It has my company logo on it, some standard legal text, my return address, and so on.  I'd like to auto-populate regions of this letter with data like the customers name and address, and then store the resultant letter in the doc management system.

Here's how we can use Doc handling to automate this (to a degree).

Create a word document that looks like you'd like the letter to appear.  For places where you'd like the customers address or name, you'll insert word Bookmarks.  In Word 2007, you can insert a Bookmark right from the ribbon bar... Insert->Links->Bookmark.  Move the cursor in the document to the position you'd like to insert the customer name, and then insert a bookmark.  Name the bookmark "CustName". 

You'll want to save this file as a word template, by going to File->Save As, and changing the type.  The template lets you control content and formatting, and is used as a starting point from which to generate new word documents that have the bookmarks filled in with real customer data.

Back in AX on the Setup form, edit the "Template File" column to point at your newly saved template.

Now flip over to the "fields" tab on this form.  Here you can hit Ctrl-N to add new Field->Bookmark mappings.  Create a mapping from data field "name" on table "CustTable", to the bookmark "CustName".  Save your configuration and then save/click OK to all of the setup forms you've got open. 

Now we're ready to try it out!

If you open up a customer, click doc handling, and then click "New->CustLetter".  Word should fire up, show you a new document named according to the configured number sequence, and the document should have the content of the template you created earlier, with the customer's name filled in where you defined the bookmark.  Save the document and you're done!

Wrap Up

Hopefully you were able to setup a new document type that exported table data to a word doc based on a template without too much trouble.  Templates can be reasonably complex, and data can come from multiple tables, but there are some limitations.