Tuesday, July 31, 2012

Reports Unpack Method raised the Debugger mode with error "Wrong Argument types in variable.."

I was updated the AX 2009 RU6 with  RU8 and as the users checked user reports; the error and debugger for unpack method is raised with the following description.

'Wrong Argument types in variable assignment'

This error can also be raised if you are importing any report to the AOT.

To Resolve the error i used following action for particular user.
1. Go to Administrator
2. Open Users form and select the user
3. Select User Options.
4. Select Usage Data
5. Click on the Reset button.

This will reset all the temp data of selection,range etc.

Friday, July 13, 2012

Cannot execute a data definition language command on (). The SQL database has issued an error.

You might get this error message following an upgrade:
Data synchronisation error
Cannot execute a data definition language command on (). The SQL database has issued an error. Problems during SQL data dictionary synchronisation. The operation failed. Synchronise failed on n table(s)
To find out exactly what the problem is you will need to have a look in the Windows event viewer on the AOS server, which will look something like this:
Duplicate record error (Event Log Entry)
If the error is similar to this (I.E of the family “The CREATE UNIQUE INDEX statement terminated because a duplicate key was found”) then you have the following options to solve the problem:
1. If you are not worried about the data in the table then the simplest solution is to drop the table
2. In AX, temporarily disable the index (that causes the duplicate) and use the table browser with filters(using data from the event log) to correct the data.
3.  Use SQL Server management studio to resolve the problem – see this microsoft knowledge base article for a great guide on how to do this: http://support.microsoft.com/kb/139444
Run the below job , in order to get the table name

static void forceDbSynchronize(Args _args)
    Dictionary              dict;
    int                     idx, lastIdx, totalTables;
    TableId                 tableId;
    Application             application;
    SysOperationProgress    progress;
    StackBase               errorStack;
    ErrorTxt                errorTxt;

    application = new Application();
    dict = new Dictionary();
    totalTables = dict.tableCnt();
    progress = new SysOperationProgress();
    errorStack = new StackBase(Types::String);

    lastIdx = 0;
        for (idx = lastIdx+1; idx <= totalTables; idx++)
            tableId = dict.tableCnt2Id(idx);

            lastIdx = idx;
            application.dbSynchronize(tableId, falsetruefalse);
    catch (Exception::Error)
        errorTxt = strFmt("Error in table '%1' (%2)", tableId, dict.tableName(tableId));

    errorTxt = errorStack.pop();
    while (errorTxt)
        errorTxt = errorStack.pop();

Sunday, July 1, 2012

How to put Ax 2009 machine back to a clean state (remove the usr layer)

1. Stop the AOS (default service name is AOS50$01 for AX5).

2. Delete the user layer aod file (…\Microsoft Dynamics AX\50\Application\Appl\AXDB_App\axusr.aod) and *.aoi files.

3. Delete the metadata file in client %userprofile%\AppData\*.auc

4. Start the AOS.

5. Run AX client and do a synchronize on the Data Dictionary node on the AOT tree.