Microsoft Dynamics AX: Print SSRS Report

Recently I have come across a requirement where, I have to print the Bill Of lading(MS dynamics out of box report) automatically based on Packing slip successful posting from sales order.

Below is the code:

  • In the IF statement, it first checks the type of object for ‘SalesFormLetter_PackingSlip’ as the salesFormLetter is the base class of many child class, so it checks specific for Packing slip plus it checks for the numberOfOrdersPosted not equal to ‘0’ ,then later I have created a new class ‘MzkPrintBOL’ with static method ‘printBOL’ which takes salesTable for further use’

Code1

First it creates a Bill of lading data (WMSBillOfLading table), then I have used to objects(see below)

  • PrintJobSettings object, the reason I have used is to get the default installed printer information from the system (i.e. printer name,port name etc.)
  • SRSPrintDestinationSetting, I have used the object to get and set the bill Of lading controller printer setting in order to directly print the report instead of showing on the screen.

Finally I called the controller.startOperation(), which actually start the report.

Code2

Hope this help!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s