Document Handling In Axapta
Document Handling In Axapta
When we create a new word document through document handling , we can transfer data from tables in Microsoft Dynamics AX to bookmarks in the new document. This is done by creating a template with some standard text and some bookmarks where the data from tables are to be inserted. For example we can transfer the address and contact information for a customer to the letter head in a Microsoft Word document when creating a new letter for that customer.
Prepare a Word template :We need to create a Word template with bookmarks where the data should be inserted. Then we set up the document type by linking the document type to the template and by adding the data fields to be transferred to the individual bookmarks.
Step I : Create a Word template
1. Open Microsoft Office Word.
2. In the new template, add the text and graphics we want to appear in all new documents that we base on the template.
3. Place the cursor where we want to insert data from Microsoft Dynamics AX and then click Insert > Bookmark.
4. Type a meaningful name for the bookmark and click Add.
5. By Repeating step 3 & 4 you can add more bookmarks as much as you require
6. Save this template by extension .dotx
Note : It is important to use a table where more than one row of data is needed. e.g. if we are expecting to insert more than one invoices for a vendor as shown in the above screen shot. This will help maintain the format when the data is populated by the system. Otherwise the data will be distorted.
Step B : Link the template to a document type
1. Click Basic > Setup > Document management > Document types.
2. Select the document type that we want to link to a template.
3. Click Options.
4. In the Table list, select the table to associate with the template.
5. In the Template file list, type the path to the template file or use the browse button to locate the file on the computer or network.
Class description: Create Word document via COM
Step C : Add bookmark information to table fields
1. Click the button “Option”.. In the Options form, On overview tab give the name of the table and path of the template file
select the table that is linked to the template that we want to use.
2. Select the Fields tab.
3. Press CTRL+N to add a field to be transferred.
4. In the Data table list, select a table to get data from.
5. In the Data field list, select the data field to get data from.
6. In Bookmark, type the name of the bookmark we have inserted in the document where the data will be inserted.
7. Select Hard return to insert a line break after the data inserted (optional).
8. Repeat step 3 through 7 to add more data fields to the list.
Note : The table we get the data from does not have to match the table selected on the Overview tab, but the two tables have to be related.
The Document handling feature can only create one letter per invoice.
On Field tab select the AX table and fields as shown below in the screen shot . For each field give the Bookmark from the template.
Step D : Test the report
Go to vendor master and select a vendor whose invoices have been pending / on hold.
Click document handling button. Indocument handling click the Button New and select the document type created in previous Step B.
A word document will be created with data for the vendor
Verify the data on the document. Pls note that the invoice number date and amount fields are nicely aligned . If the bookmarks had not been in a table in the template then the invoice details would have been distorted. ( try using a template with bookmarks without table and see yourself )
These small steps can reduce your new report requirement.