Tuesday, May 31, 2011

How to open an exe from Dynamics AX


SSRS A4 Print Layout

If you use Reporting Services, I bet you have spent a while trying to get the reports to print out as expected! I'm not sure why something that wastes so much of everybodies time (printing things out properly) is not well-known and fixed in software now - it should be impossible to get it wrong. The print knows its paper size, the software knows the paper size yet it prints out most of your document on one sheet and then a little strip on the next - obviously what you wanted!
Anyway, in reporting services there are some quirks that you need to know about in order to get your report correct.
1) Select Report - Report Properties and the Layout tab. There are paper sizes and margins in here. Note that the page sizes here need to match the physical paper size. I'm not sure what effect they have because it doesn't draws these on your report design!
2) You might think that is it BUT you then need to right-click on the grid area of the report in the layout view and choose properties (properties of the body of the report) and lo and behold there is another field here called "Size" which consists of width,height in measurement units (mm, inches etc) which defines the area of the report body. For some reason this is not restricted by the page size in report properties and you won't know if you make this too big! Anyway, this needs to equal the page size minus margins if you want it to fit on one sheet.

Example A4 paper is 210mm by 297mm so you set the report layout (in Report -> Report Properties) to these figures and then suppose you set the margins to 10mm all the way round. The report body should be set to 210 - 20 (for width) and 297 - 20 (for height) when in portrait or 297 - 20 (width) x 210 - 20 (height) when in landscape mode. It sounds really simple but it still takes time to find these things out!

More Links: http://blogs.msdn.com/b/bwelcker/archive/2005/08/19/454043.aspx

SSRS Direct Printing


Thursday, May 19, 2011

SSRS: Changing Ruler Settings

Change Regional Settings from English (United States) to English (Australia)
ie through Start > Control Panel > Regional and Language Settings.

Printing Dynamics AX Company Logo using in SRS

Query: Can I display company logo / image in SRS

In order to do that create one metod in AX, X++ as following.
static public str getImage()
    CompanyInfo info = CompanyInfo::find();
    BinData binData = new BinData();
    str ret;
    //conver image to base64String as .net requirement
    bindata.setData(CompanyImage::find(curext(), info.TableId, info.RecId).Image);
    ret = binData.base64Encode();
    return ret;

Call this method in SRS and set the source of the image to be this method.
[DataMethod(), AxSessionPermission(SecurityAction.Assert)]
    public static System.Byte[] GetCompanyLogo()
        string logoImage = (string)SessionManager.GetSession().CallStaticRecordMethod("CompanyInfo", "getImage");
        byte[] imageBytes = Convert.FromBase64String(logoImage);
        return imageBytes;

Wednesday, May 18, 2011

ssrs unable to load client print control

Our Server environment : SQL2008 x64 SP2 Reporting Services on Windows Server 2008 x64,
Client PC environment: Windows XP SP2 with IE6 or higher, all users are login to Active Directory, users are not members of local Administrator or power user group.
Error: When a user printing a report  getting an error as "Unable to load client print control"
Solution that work for us: replace following files in sql 2008 with SQL 2008 R2
Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin
Once you replace files on server side users wont get above error but it is required to do one time installation of this Active X component as a local Administrator or power user. If you are having large number of computers running on Active Directory environment you may create a MSI file with rsclientprint.dll and deploy using AD or SMS. Also I'm  recommending to add report server URL as a trusted site (add to Trusted sites) via Active Directory GP.
Hope this will help for somebody to sort out this "hectic" problem. We had very tough time to find out a proper solution for this "bug".

Wednesday, May 4, 2011

Dynamics AX Reporting Services Error: AX_CompanyName parameter issue

If you are getting a AX_CompanyName parameter issue when running a report, this is because your business connector configuration does not have a company name. Create a custom configuration and set the company ID to resolve the error.

PS: Make sure to restart reporting services, service.

Tuesday, May 3, 2011

Dynamics AX Reporting Services Error : Could Not Load Assembly

I am getting the following error when deploying reports,
 Could not load or find Microsoft.Dynamics.Kernel.Client.dll

Make sure the Microsoft.Dynamics.Setup.ReportingServices.dll has been copied as per KB957312 before you do the reporting extensions installation was done.
Do the installation of KB957312
Run the application component of the KB957312 was applied to the AOS server.
Applied the Kernel component of KB 957312 to the server where the reporting extensions are applied.
Ran the installation and it worked properly.
Another option instead of copying the missing DLL's is to copy the AxReports.exe file from the c:\program files\Microsoft Dynamics AX\50\Reporting Services directory to the client directory where your Ax32.exe is located, and run it (AxReports.exe) from the client directory.
 Hope this helps someone.
PS: KB957312 refers to a 32 bit opearating system ony, but is works for a 64 bit operating system as well.

Dynamics AX Message Box

I need to ask a confirmation from the user for a operation. How can we achieve it?

You can use the Box class available in Dynamics for it.

Sunday, May 1, 2011

Dynamics AX SRS Browser Not Showing up

I am getting a blank SRS report viewer using I try to view any report.

This is because you might have select to hide the Active X control by right clicking and selecting hide. In order to show it back, open SRSReportView form from AOT, add another Active X control and now open the form. After opening the form right click on the form and select setup, select the first browser control from left and select visible to true.

Dynamics AX 2012 Unleashed

Found out today that my good friend David Weiner is writing book on Dynamics AX 2012, pre order it at http://www.amazon.com/Microsoft-Dynamics-AX-2012-Unleashed/dp/0672335484