Showing posts from August, 2013

Print PDF files from AX X++ code

Print External PDF file from AX This job illustrates how we can print an external PDF file to a printer chosen in AX through X++ code. Here a code sample (X++ job) to do this.

static void theAxapta_pdfprint(Args _args) { PrintJobSettings printJobSettings = new PrintJobSettings(); Dialog dialog = new Dialog(); DialogField dialogFileName; str adobeExe; str adobeParm; ; dialogFilename = dialog.addField(typeid(FilenameOpen)); if ( { printJobSettings.printerSettings('SysPrintForm'); adobeExe = WinAPI::findExecutable(dialogFileName.value()); adobeParm = strFmt(' /t "%1" "%2" "%3" "%4"', dialogFileName.value(), printJobSettings.printerPrinterName(), printJobSettings.printerDriverName(), …

Dynamics AX 2012 Certification Exams Details- Part I

Dynamics AX 2012 Certification Exams Details- Part I

Exam titleExam numberMicrosoft Dynamics AX 2012 Trade and LogisticsMB6-870Microsoft Dynamics AX 2012 FinancialsMB6-871Microsoft Dynamics AX 2012 Development IntroductionMB6-869Microsoft Dynamics AX 2012 Installation and ConfigurationMB6-872Microsoft Dynamics AX 2012 Process Manufacturing Production and LogisticsMB6-886Microsoft Dynamics AX 2012 Lean ManufacturingMB6-884Microsoft Dynamics AX 2012 Public SectorMB6-885Microsoft Dynamics AX 2012 Service ManagementMB6-889

Error: An Unbalanced X++ TTSBEGIN/TTSCOMMIT pair has been detected... In AX

Error:  When trying to create a new record(s) in any table system shows following error eg. At the time of creating new Sales Order and this error may appear. Possible Reason(s): TTS level '1' usually leaves your Ax session in an unusable state that you can't close properly.
Check all code for form or class from where this error comes and count the ttsbegin and ttscommit there must be same like if u write 2 ttsbegin u must have to write 2 ttscommit.
Solution: To resolve this error this TTS level should be ZERO, Run this job to get rid of that error, this job will find the tts level where its greater than zero and make it zero by calling TTSABORT. static void TheAxaptaResetTTS(Args _args)
    while (appl.ttsLevel() > 0)
        info(strfmt("Level %1 aborted",appl.ttsLevel()));
Other Info: ttsBegin: marks the beginning of a transaction. This ensures data integrity, and guarantees that all updates performed until the transaction ends (by …

Create Progress bars in Dynamics AX

Create Progress bars in Dynamics AX [startlengthyoperation, SysOperationProgress,Animations ]Progress bars are inbuilt in runbase frameworks. We can Use a progress indicator during operations that take more than 2 seconds 
Use an hourglass mouse pointer if the process takes 2-7 seconds.
Use a progress bar if the process takes 8 seconds or more.

There are many ways to display operations in progress
1) Hourglass Indicators
2) Progress Bars
3) Progress controls on the forms
4) Animate Controls

Hour Glass Indicators Example:

Use startlengthyoperation() and endlengthyoperation() between ur business logic
Example :

static void HourGlassMousePointer(Args _args)
int i;
str value;

for( i = 1; i <= 10000; i++)
value += int2str(i) + ','; // some business logic


Below is how the hourglass indicator looks

Use SysOperationProgress class to show the progress Bars
Initialize a SysOperationProgress variable.
Set a caption for the form by using the Sy…

Huge InventSumLogTTS table

How to fix the performance issue due to the huge InventSumLogTTS table?
When you run Master Planning, the InventSumLogTTS table enables Master Scheduling to be updated based on the changes to transactions. After Master Scheduling runs, the records in the InventSumLogTTS table are deleted. When Master planning license is present and configuration turned on, the master planning execution should clean this log periodically. But when this is seldom used, the cleanup will be less frequent contributing to the growth of the table.
If you are running master planning on a regular basis then this table will get cleaned up.


Extended Query Range in Dynamics AX

Hi Friends, Many developers often stuck while they try to apply range to the Dynamics AX queryto filter records based on some conditions. We will try to explore the query ranges in this article and will try to play with some examples to learn how we canapply query ranges using x++to the Dynamics AX queries.
Let’s discussed different cases...
Query q;
QueryBuildDataSource qbd;
QueryBuildRange qbr;
q = new Query();
qbd = q.addDataSource(TableNum(CustTable));
qbr = qbd.addRange(FieldNum(CustTable, AccountNum));
qbr.value('4005, 4006');
The above x++ code will generate following SQL statement.
"SELECT * FROM CustTable WHERE ((AccountNum = N'4005' OR AccountNum = N'4006'))"
qbr.value(strFmt('((AccountNum == "%1") (AccountNum == "%2"))', QueryValue('4005'), QueryValue('4006')));
The above x++ code will generate following SQL statement.
"SELECT * FROM CustTable WHERE ((((AccountNum == "4005") || (AccountNum =…