"Object reference not set to an instance of an object" error in Microsoft Management Reporter 2012 for Microsoft Dynamics AX 2012

This article provides a resolution for the Object reference not set to an instance of an object error that occurs in Microsoft Management Reporter 2012 for Microsoft Dynamics AX 2012.

Applies to:   Microsoft Management Reporter 2012, Microsoft Dynamics AX 2012 R3
Original KB number:   2967363

Symptoms

You receive the following error in the integration logs in the Management Reporter Configuration Console in Microsoft Management Reporter 2012 for Microsoft Dynamics AX 2012:

[AX 2012 Accounts to Account] has encountered an error. Processing will be aborted. Error text: Object reference not set to an instance of an object.

Additionally, the following error may also appear in the Event Viewer:

Caught Exception: [System.NullReferenceException] Object reference not set to an instance of an object.Stack trace:at
Microsoft.Dynamics.Integration.Adapters.AX2012GL.DataAccessHelper.GetEnumLabelId(EnumMetadata enumList, Nullable`1 value) at
Microsoft.Dynamics.Integration.Adapters.AX2012GL.DataAccessHelper.GetEnumLabelId(EnumMetadata enumList, Nullable`1 value) at
Microsoft.Dynamics.Integration.Adapters.AX2012GL.AX2012GLAdapter.GetEnumValueLabelString(String enumName, Nullable`1 value) at
Microsoft.Dynamics.Integration.Adapters.AX2012GL.AccountObjectProvider.PopulateAccountAttributes(SqlDataReader accountReader) at
Microsoft.Dynamics.Integration.Adapters.AX2012GL.AccountObjectProvider.CreateAccount(SqlDataReader reader, Dimension mainAccountDimension, Int64 mainAccountRecId) at Microsoft.Dynamics.Integration.Adapters.AX2012GL.AccountObjectProvider.QueryAccountValues() at
Microsoft.Dynamics.Integration.Adapters.AX2012GL.AccountObjectProvider.ReadObjectKeys(DateTime modifiedDate) at
Microsoft.Dynamics.Integration.Service.Tasks.MapWork.ReadObjectKeyList(DbMap map, DateTime queryDate, Int32& count)at
Microsoft.Dynamics.Integration.Service.Tasks.MapWork.ProcessRecordsImplementation(OperationType operationType)

Cause

This issue occurs because a post type that exists in the MainAccount table in the AX database but not exists in Application Object Tree (AOT).

Resolution

To resolve this issue, follow these steps:

  1. Run the following SQL statement against the AX database to check the posting type of the accounts:

    select distinct (postingtype) from MainAccount
    
  2. Sign in to AX and check the AOT. To browse to AOT, select Data Dictionary, select Base Enums, and then select LedgerPostingType. Check the properties of each item and note the EnumValues table.

  3. If differences are found between the MainAccount table and the EnumValues table in AOT, the accounts that contain invalid posting types have to have a valid posting type set.

    For example, use the following statement to update the MainAccount table in which an invalid posting type of 255 does not exist in AOT. This statement set the posting type to a valid kind of 0.

    update MainAccount set postingtype = 0 where postingtype = 255
    
  4. When you update the MainAccount table, you have to rebuild the Management Reporter Data Mart. To do this, follow these steps:

    1. Select Start, open the configuration console on the server.
    2. In the left navigation pane, select ERP Integrations.
    3. Select the integration that is being used and then disable the integration by selecting Disable Integration.
    4. Select Remove to remove the ERP integration.
    5. Select Management Reporter Services in the left navigation and stop both of the Management Reporter services.
    6. Backup and delete the DDB database in the Microsoft SQL Management Studio.
    7. Start the Management Reporter services.
    8. Select File and then select Configure to configure the ERP integration again.
    9. When the integration is configured, select the integration from the left side of the configuration console, and then select Enable Integration.