Friday, June 13, 2014

Export Sales Order Data to MS Word template with Dynamics AX 2012 ( Document Management )


Often, the customer asked to modify the layout of the Standard reports to meet existing templates or tastes. and as we all know that changing the layout in the SSRS reports will take long time. Instead we can use one of the Dynamics AX functionality to export the customer data to MS Word Template in simple way and short time.  

The Document management functionality in Microsoft Dynamics AX give you the ability to attach files to records. For example, you can attach PDF, Microsoft Word, or Microsoft Excel files to a purchase order or a sales order. You can also create Word and Excel templates from Microsoft Dynamics AX data. 


This Article will discuss how to use MS Word templates rather than customize the standard SSRS reports in Dynamics AX 2012.

In the following sections we will discuss how to export data from Microsoft Dynamics AX Sales order to MS Word templates.

This article divided into three parts.

  • Prerequisites (Step by step with screenshots )
  • Setup (Step by step with screenshots )
  • Implementation (Step by step with screenshots )

Prerequisites:                                                            
Create Sales Order Template by following these steps:

Open new Microsoft word document ( I use Office 2010)


Design the Sales Order layout (Add company logo, Report header,report label).To simplify the subject I will add a few labels as follow:
    • Sales Order
    • Customer Account
    • Shipping Date
    • Delivery Date
    • Item Code
    • Description
    • Qty
    • Unit Price

Add Bookmark to each Label ( Bookmarks will be used to map the sales order fields to the Word template )
    1. But the courser after the sales order label 
    2. Go to Insert TAB and click the Bookmark Button 

          3.write the new bookmark name and click the add button


          4.Repeat the steps from 1 to 2 with all Labels


           5.Save the word file as Word Template


Setup:                                                                           

Go to Organization Administration > Setup > Document Management > Document Management Parameter


Click the number sequence Tab > Assign  number sequence to the Document file counter


Click the File types Tab > Click Add Button > Add the Microsoft word template file type if not exist and close the screen


Go to Organization Administration > Setup > Document types


Click new and follow the steps in the following screenshot to add new document type


Click the Option Button


from the Table drop down list select the "SalesTable"


in the template file field click the folder icon and select the Sales order template that we create before


Go to the Field Tab

  1. in the data field select the "SalesId"(this field contain the Sales Order Number/Code)

  2. in the bookmark field write the bookmark name Which corresponds to "SalesId" in this case write "SalesOrder"

Repeat steps from 10 to 11 with all fields that you want to export and link it to the  corresponds bookmark( make sure to select the "SalesLine" table in the Data Table Filed before mapping the Sales Order line filed to the  corresponds  Bookmark see the orange rectangle)


Implementation:                                                      

Go to > Account Receivable >Common Sales Order > All Sales Orders


Select any Sales Order and Click the Attachment Button


Click the New Button and Select the SOT


the System will start the export process


New document will be created and the Sales Order Data will be populated  automatically.


that's all. Cool :)



See Also

  1. Export Purchase Order Data to MS Excel template with Dynamics AX 2012 ( Document Management )
To get new posts and updates, please follow the blog by clicking the Join this site Button in the top-right side under my personal information

5 comments:

  1. It is a very useful information.can you suggest if I want insert rows in the table filling the table instead area in the table. Why? because I tried with bigger description and my order was totally a mess; the item ids were on top and descriptions were not understandable. I hope you have been able to understand the problem.

    ReplyDelete
    Replies
    1. Hi Ahemd,

      Even we faced the same issue while implementing Document handling.
      That's the issue in std. logic, it won't consider as row wise details. It only consider bookmarks and keep on appending values at particular book marks.

      We have done customization to avoid this issue. Added new column in DocuField table i.e., Row wise (Check box), to identify row wise columns. And for each row identify maximum lines & based on that adjusting printing book marks.

      Hope you understand...

      Best Regards,
      Shankar

      Delete
  2. Hi,

    have You ever used Document type with class Create MS Excel modelu COM,
    I would like to use it but I have no idea how to add a bookmark to excel

    ReplyDelete
    Replies
    1. Hi,
      With Excel there is no bookmark instead use the hyperlink.
      I am going to post new article regarding this issue soon.

      Regards

      Delete
  3. Hi,

    Is this functionality not available in D356-F&O? I checked in it, but not finding the option " Create a Microsoft Word document by using COM" in it. Can you please suggest if any other option is there in D365FO if this is not available? Thanks.

    ReplyDelete