Dimensions of the general ledger entries are incorrect when you run the "Unapply Entries" function for a customer in Microsoft Dynamics NAV 2009

This article applies to Microsoft Dynamics NAV for all countries and all language locales.

Symptoms

Assume that you apply multiple payments that has different dimensions to an invoice for a customer in Microsoft Dynamics NAV 2009. When you run the Unapply Entries function for the customer, the dimensions of the general ledger entries are incorrect.

This problem occurs in the following products:

  • Microsoft Dynamics NAV 2009 R2

  • Microsoft Dynamics NAV 2009 Service Pack 1 (SP1)


Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Dynamics NAV 2009 service pack or the next Microsoft Dynamics NAV version that contains this hotfix.

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Installation information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Note Before you install this hotfix, verify that all Microsoft Dynamics NAV client users are logged off the system. This includes Microsoft Dynamics NAV Application Server (NAS) services. You should be the only client user who is logged on when you implement this hotfix.

To implement this hotfix, you must have a developer license.

We recommend that the user account in the Windows Logins window or in the Database Logins window be assigned the "SUPER" role ID. If the user account cannot be assigned the "SUPER" role ID, you must verify that the user account has the following permissions:

  • The Modify permission for the object that you will be changing.

  • The Execute permission for the System Object ID 5210 object and for the System Object ID 9015

    object.

Note You do not have to have rights to the data stores unless you have to perform data repair.

Code changes

Note Always test code fixes in a controlled environment before you apply the fixes to your production computers.

To resolve this problem, use the following steps:

  1. Change the code in the UnapplyCustLedgEntry function in the Gen. Jnl.-Post Line Codeunit (12) as follows:
    Existing code 1

    ...
    TempVatEntryNo@1028 : Integer;
    BEGIN
    ...

    Replacement code 1

    ...
    TempVatEntryNo@1028 : Integer;

    // Add the following lines.
    MultipleDimensions@1170000000 : Boolean;
    CustEntryAppPostEntries@1170000001 : Codeunit 226;
    TotalAmtMD@1170000004 : ARRAY [10] OF Decimal;
    TotalAmtAddCurMD@1170000003 : ARRAY [10] OF Decimal;
    DimArr@1170000002 : ARRAY [2,10] OF Code[10];
    Arrlen@1170000005 : Integer;
    NewComb@1170000006 : Boolean;
    // End of the added lines.

    BEGIN
    ...

    Existing code 2

    ...
    DtldCustLedgEntry2.FINDSET;

    // Delete the following lines.
    LedgEntryDim.SETRANGE("Table ID",DATABASE::"Cust. Ledger Entry");
    LedgEntryDim.SETRANGE("Entry No.",DtldCustLedgEntry2."Applied Cust. Ledger Entry No.");
    TempJnlLineDim.RESET;
    TempJnlLineDim.DELETEALL;
    DimMgt.CopyLedgEntryDimToJnlLineDim(LedgEntryDim,TempJnlLineDim);
    IF TempJnlLineDim.GET(DATABASE::"Cust. Ledger Entry",'','',0,0,GLSetup."Global Dimension 1 Code") THEN
    GenJnlLine."Shortcut Dimension 1 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 1 Code" := '';
    IF TempJnlLineDim.GET(DATABASE::"Cust. Ledger Entry",'','',0,0,GLSetup."Global Dimension 2 Code") THEN
    GenJnlLine."Shortcut Dimension 2 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 2 Code" := '';
    // End of the deleted lines.

    REPEAT
    ...

    Replacement code 2

    ...
    DtldCustLedgEntry2.FINDSET;

    // Add the following lines.
    MultipleDimensions := CustEntryAppPostEntries.MultipleDimensions(DtldCustLedgEntry2."Initial Entry Global Dim. 1",
    DtldCustLedgEntry2."Initial Entry Global Dim. 2",DtldCustLedgEntry2);
    // End of the added lines.

    REPEAT
    ...

    Existing code 3

    ...
    REPEAT

    // Delete the following lines.
    NewDtldCustLedgEntry := DtldCustLedgEntry2;
    NewDtldCustLedgEntry."Entry No." := NextDtldLedgEntryEntryNo;
    NewDtldCustLedgEntry."Posting Date" := GenJnlLine."Posting Date";
    NewDtldCustLedgEntry."Transaction No." := NextTransactionNo;
    NewDtldCustLedgEntry.Amount := -DtldCustLedgEntry2.Amount;
    NewDtldCustLedgEntry."Amount (LCY)" := -DtldCustLedgEntry2."Amount (LCY)";
    NewDtldCustLedgEntry."Debit Amount" := -DtldCustLedgEntry2."Debit Amount";
    NewDtldCustLedgEntry."Credit Amount" := -DtldCustLedgEntry2."Credit Amount";
    NewDtldCustLedgEntry."Debit Amount (LCY)" := -DtldCustLedgEntry2."Debit Amount (LCY)";
    NewDtldCustLedgEntry."Credit Amount (LCY)" := -DtldCustLedgEntry2."Credit Amount (LCY)";
    NewDtldCustLedgEntry.Unapplied := TRUE;
    NewDtldCustLedgEntry."Unapplied by Entry No." := DtldCustLedgEntry2."Entry No.";
    NewDtldCustLedgEntry."Document No." := GenJnlLine."Document No.";
    NewDtldCustLedgEntry."Source Code" := GenJnlLine."Source Code";
    NewDtldCustLedgEntry."User ID" := USERID;
    NewDtldCustLedgEntry.INSERT;
    NextDtldLedgEntryEntryNo := NextDtldLedgEntryEntryNo + 1;
    // End of the deleted lines.
    ...

    Replacement code 3

    ...
    REPEAT

    // Add the following lines.
    IF DtldCustLedgEntry2."Applied Cust. Ledger Entry No." <> 0 THEN BEGIN
    LedgEntryDim.RESET;
    LedgEntryDim.SETRANGE("Table ID",DATABASE::"Cust. Ledger Entry");
    LedgEntryDim.SETRANGE("Entry No.",DtldCustLedgEntry2."Applied Cust. Ledger Entry No.");
    TempJnlLineDim.RESET;
    TempJnlLineDim.DELETEALL;
    DimMgt.CopyLedgEntryDimToJnlLineDim(LedgEntryDim,TempJnlLineDim);
    IF TempJnlLineDim.GET(DATABASE::"Cust. Ledger Entry",'','',0,0,GLSetup."Global Dimension 1 Code") THEN
    GenJnlLine."Shortcut Dimension 1 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 1 Code" := '';
    IF TempJnlLineDim.GET(DATABASE::"Cust. Ledger Entry",'','',0,0,GLSetup."Global Dimension 2 Code") THEN
    GenJnlLine."Shortcut Dimension 2 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 2 Code" := '';
    END ELSE BEGIN
    GenJnlLine."Shortcut Dimension 1 Code" := DtldCVLedgEntryBuf."Initial Entry Global Dim. 1";
    GenJnlLine."Shortcut Dimension 2 Code" := DtldCVLedgEntryBuf."Initial Entry Global Dim. 2";
    END;
    // End of the added lines.
    ...

    Existing code 4

    ...
    // Delete the following lines.
    DtldCVLedgEntryBuf.TRANSFERFIELDS(NewDtldCustLedgEntry);
    GenJnlLine."Source Currency Code" := DtldCustLedgEntry2."Currency Code";
    IF GLSetup."Additional Reporting Currency" <> DtldCVLedgEntryBuf."Currency Code" THEN
    DtldCVLedgEntryBuf."Additional-Currency Amount" :=
    CalcAddCurrForUnapplication(DtldCVLedgEntryBuf."Posting Date",DtldCVLedgEntryBuf."Amount (LCY)")
    ELSE
    IF GLSetup."Additional Reporting Currency" <> '' THEN
    DtldCVLedgEntryBuf."Additional-Currency Amount" := DtldCVLedgEntryBuf.Amount;
    CurrencyLCY.InitRoundingPrecision;
    // End of the deleted lines.
    ...

    Replacement code 4

    ...
    // Add the following lines.
    NewDtldCustLedgEntry := DtldCustLedgEntry2;
    NewDtldCustLedgEntry."Entry No." := NextDtldLedgEntryEntryNo;
    NewDtldCustLedgEntry."Posting Date" := GenJnlLine."Posting Date";
    NewDtldCustLedgEntry."Transaction No." := NextTransactionNo;
    NewDtldCustLedgEntry.Amount := -DtldCustLedgEntry2.Amount;
    NewDtldCustLedgEntry."Amount (LCY)" := -DtldCustLedgEntry2."Amount (LCY)";
    NewDtldCustLedgEntry."Debit Amount" := -DtldCustLedgEntry2."Debit Amount";
    NewDtldCustLedgEntry."Credit Amount" := -DtldCustLedgEntry2."Credit Amount";
    NewDtldCustLedgEntry."Debit Amount (LCY)" := -DtldCustLedgEntry2."Debit Amount (LCY)";
    NewDtldCustLedgEntry."Credit Amount (LCY)" := -DtldCustLedgEntry2."Credit Amount (LCY)";
    NewDtldCustLedgEntry.Unapplied := TRUE;
    NewDtldCustLedgEntry."Unapplied by Entry No." := DtldCustLedgEntry2."Entry No.";
    NewDtldCustLedgEntry."Document No." := GenJnlLine."Document No.";
    NewDtldCustLedgEntry."Source Code" := GenJnlLine."Source Code";
    NewDtldCustLedgEntry."User ID" := USERID;
    NewDtldCustLedgEntry.INSERT;
    NextDtldLedgEntryEntryNo := NextDtldLedgEntryEntryNo + 1;
    // End of the added lines.
    ...

    Existing code 5

    ...
    IF DtldCustLedgEntry2."Entry Type" IN [
    ...

    Replacement code 5

    ...
    // Add the following lines.
    DtldCVLedgEntryBuf.TRANSFERFIELDS(NewDtldCustLedgEntry);
    GenJnlLine."Source Currency Code" := DtldCustLedgEntry2."Currency Code";
    IF GLSetup."Additional Reporting Currency" <> DtldCVLedgEntryBuf."Currency Code" THEN
    DtldCVLedgEntryBuf."Additional-Currency Amount" :=
    CalcAddCurrForUnapplication(DtldCVLedgEntryBuf."Posting Date",DtldCVLedgEntryBuf."Amount (LCY)")
    ELSE
    IF GLSetup."Additional Reporting Currency" <> '' THEN
    DtldCVLedgEntryBuf."Additional-Currency Amount" := DtldCVLedgEntryBuf.Amount;
    CurrencyLCY.InitRoundingPrecision;
    // End of the added lines.

    IF DtldCustLedgEntry2."Entry Type" IN [
    ...

    Existing code 6

    ...
    END;

    // Delete the following lines.
    TotalAmountLCY := TotalAmountLCY + DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmountAddCurr := TotalAmountAddCurr + DtldCVLedgEntryBuf."Additional-Currency Amount";
    IF DtldCVLedgEntryBuf."Entry Type" = DtldCVLedgEntryBuf."Entry Type"::Application THEN BEGIN
    IF DtldCVLedgEntryBuf."Amount (LCY)" >= 0 THEN BEGIN
    PositiveLCYAppAmt := PositiveLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    PositiveACYAppAmt :=
    PositiveACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END ELSE BEGIN
    NegativeLCYAppAmt := NegativeLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    NegativeACYAppAmt :=
    NegativeACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    // End of the deleted lines.

    END;
    ...

    Replacement code 6

    ...
    END;

    // Add the following lines.
    IF NOT MultipleDimensions THEN BEGIN
    TotalAmountLCY := TotalAmountLCY + DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmountAddCurr := TotalAmountAddCurr + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END ELSE BEGIN
    NewComb := TRUE;
    IF Arrlen > 0 THEN
    FOR i:= 1 TO Arrlen DO BEGIN
    IF (DimArr[1][i] = DtldCustLedgEntry2."Initial Entry Global Dim. 1") AND
    (DimArr[2][i] = DtldCustLedgEntry2."Initial Entry Global Dim. 2") THEN BEGIN
    NewComb := FALSE;
    TotalAmtMD[i] += DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmtAddCurMD[i] += DtldCVLedgEntryBuf."Additional-Currency Amount";
    i := Arrlen;
    END;
    END;
    IF NewComb THEN BEGIN
    Arrlen += 1;
    DimArr[1][Arrlen] := DtldCustLedgEntry2."Initial Entry Global Dim. 1";
    DimArr[2][Arrlen] := DtldCustLedgEntry2."Initial Entry Global Dim. 2";
    TotalAmtMD[Arrlen] += DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmtAddCurMD[Arrlen] += DtldCVLedgEntryBuf."Additional-Currency Amount";
    // End of the added lines.

    END;
    ...

    Existing code 7

    ...
    END;
    IF NOT (DtldCVLedgEntryBuf."Entry Type" IN [
    ...

    Replacement code 7

    ...
    END;

    // Add the following lines.
    IF DtldCVLedgEntryBuf."Entry Type" = DtldCVLedgEntryBuf."Entry Type"::Application THEN BEGIN
    IF DtldCVLedgEntryBuf."Amount (LCY)" >= 0 THEN BEGIN
    PositiveLCYAppAmt := PositiveLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    PositiveACYAppAmt :=
    PositiveACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END ELSE BEGIN
    NegativeLCYAppAmt := NegativeLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    NegativeACYAppAmt :=
    NegativeACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END;
    END;
    // End of the added lines.

    IF NOT (DtldCVLedgEntryBuf."Entry Type" IN [
    ...

    Existing code 8

    ...
    IF (TotalAmountLCY <> 0) OR

    // Delete the following lines.
    (TotalAmountAddCurr <> 0) AND (GLSetup."Additional Reporting Currency" <> '')
    THEN BEGIN
    InitGLEntry(CustPostingGr."Receivables Account",TotalAmountLCY,TotalAmountAddCurr,TRUE,TRUE);
    InsertGLEntry(TRUE);
    // End of the deleted lines.

    END;
    ...

    Replacement code 8

    ...
    // Add the following lines.
    IF NOT MultipleDimensions THEN BEGIN
    IF (TotalAmountLCY <> 0) OR
    (TotalAmountAddCurr <> 0) AND (GLSetup."Additional Reporting Currency" <> '')
    THEN BEGIN
    InitGLEntry(CustPostingGr."Receivables Account",TotalAmountLCY,TotalAmountAddCurr,TRUE,TRUE);
    InsertGLEntry(TRUE);
    END;
    END ELSE BEGIN
    FOR i := 1 TO Arrlen DO BEGIN
    IF (TotalAmtMD[i] <> 0) OR
    (TotalAmtAddCurMD[i] <> 0) AND (GLSetup."Additional Reporting Currency" <> '')
    THEN BEGIN
    GenJnlLine."Shortcut Dimension 1 Code" := DimArr[1][i];
    GenJnlLine."Shortcut Dimension 2 Code" := DimArr[2][i];
    InitGLEntry(CustPostingGr."Receivables Account",TotalAmtMD[i],TotalAmtAddCurMD[i],TRUE,TRUE);
    InsertGLEntry(TRUE);
    END;
    END;
    // End of the added lines.

    END;
    ...
  2. Add the following local variables to the UnapplyVendLedgEntry function:

    MultipleDimensions@1170000004 : Boolean;
    VendEntryAppPostEntries@1170000003 : Codeunit 227;
    TotalAmtMD@1170000001 : ARRAY [10] OF Decimal;
    TotalAmtAddCurMD@1170000000 : ARRAY [10] OF Decimal;
    DimArr@1170000007 : ARRAY [2,10] OF Code[10];
    Arrlen@1170000006 : Integer;
    NewComb@1170000005 : Boolean;
  3. Change the code in the UnapplyVendLedgEntry function in the Gen. Jnl.-Post Line Codeunit (12) as follows:
    Existing code 1

    ...
    DtldVendLedgEntry2.FINDSET;

    // Delete the following lines.
    LedgEntryDim.SETRANGE("Table ID",DATABASE::"Vendor Ledger Entry");
    LedgEntryDim.SETRANGE("Entry No.",DtldVendLedgEntry2."Applied Vend. Ledger Entry No.");
    TempJnlLineDim.RESET;
    TempJnlLineDim.DELETEALL;
    DimMgt.CopyLedgEntryDimToJnlLineDim(LedgEntryDim,TempJnlLineDim);
    IF TempJnlLineDim.GET(DATABASE::"Vendor Ledger Entry",'','',0,0,GLSetup."Global Dimension 1 Code") THEN
    GenJnlLine."Shortcut Dimension 1 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 1 Code" := '';
    IF TempJnlLineDim.GET(DATABASE::"Vendor Ledger Entry",'','',0,0,GLSetup."Global Dimension 2 Code") THEN
    GenJnlLine."Shortcut Dimension 2 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 2 Code" := '';
    // End of the deleted lines.

    REPEAT
    ...

    Replacement code 1

    ...
    DtldVendLedgEntry2.FINDSET;

    // Add the following lines.
    MultipleDimensions := VendEntryAppPostEntries.MultipleDimensions(DtldVendLedgEntry2."Initial Entry Global Dim. 1",
    DtldVendLedgEntry2."Initial Entry Global Dim. 2",DtldVendLedgEntry2);
    // End of the added lines.

    REPEAT
    ...

    Existing code 2

    ...
    REPEAT

    // Delete the following line.
    DtldVendLedgEntry2.TESTFIELD(Unapplied,FALSE);
    // End of the deleted line.
    ...

    Replacement code 3

    ...
    REPEAT

    // Add the following lines.
    IF DtldVendLedgEntry2."Applied Vend. Ledger Entry No." <> 0 THEN BEGIN
    LedgEntryDim.RESET;
    LedgEntryDim.SETRANGE("Table ID",DATABASE::"Vendor Ledger Entry");
    LedgEntryDim.SETRANGE("Entry No.",DtldVendLedgEntry2."Applied Vend. Ledger Entry No.");
    TempJnlLineDim.RESET;
    TempJnlLineDim.DELETEALL;
    DimMgt.CopyLedgEntryDimToJnlLineDim(LedgEntryDim,TempJnlLineDim);
    IF TempJnlLineDim.GET(DATABASE::"Vendor Ledger Entry",'','',0,0,GLSetup."Global Dimension 1 Code") THEN
    GenJnlLine."Shortcut Dimension 1 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 1 Code" := '';
    IF TempJnlLineDim.GET(DATABASE::"Vendor Ledger Entry",'','',0,0,GLSetup."Global Dimension 2 Code") THEN
    GenJnlLine."Shortcut Dimension 2 Code" := TempJnlLineDim."Dimension Value Code"
    ELSE
    GenJnlLine."Shortcut Dimension 2 Code" := '';
    END ELSE BEGIN
    GenJnlLine."Shortcut Dimension 1 Code" := DtldVendLedgEntry2."Initial Entry Global Dim. 1";
    GenJnlLine."Shortcut Dimension 2 Code" := DtldVendLedgEntry2."Initial Entry Global Dim. 2";
    END;
    // End of the added lines.
    ...

    Existing code 4

    ...
    NewDtldVendLedgEntry := DtldVendLedgEntry2;
    ...

    Replacement code 4

    ...
    // Add the following line.
    DtldVendLedgEntry2.TESTFIELD(Unapplied,FALSE);
    // End of the added line.

    NewDtldVendLedgEntry := DtldVendLedgEntry2;
    ...

    Existing code 5

    ...
    END;

    // Delete the following lines.
    TotalAmountLCY := TotalAmountLCY + DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmountAddCurr := TotalAmountAddCurr + DtldCVLedgEntryBuf."Additional-Currency Amount";
    IF DtldCVLedgEntryBuf."Entry Type" = DtldCVLedgEntryBuf."Entry Type"::Application THEN BEGIN
    IF DtldCVLedgEntryBuf."Amount (LCY)" >= 0 THEN BEGIN
    PositiveLCYAppAmt := PositiveLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    PositiveACYAppAmt :=
    PositiveACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END ELSE BEGIN
    NegativeLCYAppAmt := NegativeLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    NegativeACYAppAmt :=
    NegativeACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    // End of the deleted lines.

    END;
    ...

    Replacement code 5

    ...
    END;

    // Add the following lines.
    IF NOT MultipleDimensions THEN BEGIN
    TotalAmountLCY := TotalAmountLCY + DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmountAddCurr := TotalAmountAddCurr + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END ELSE BEGIN
    NewComb := TRUE;
    IF Arrlen > 0 THEN
    FOR i:= 1 TO Arrlen DO BEGIN
    IF (DimArr[1][i] = DtldVendLedgEntry2."Initial Entry Global Dim. 1") AND
    (DimArr[2][i] = DtldVendLedgEntry2."Initial Entry Global Dim. 2") THEN BEGIN
    NewComb := FALSE;
    TotalAmtMD[i] += DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmtAddCurMD[i] += DtldCVLedgEntryBuf."Additional-Currency Amount";
    i := Arrlen;
    END;
    END;
    IF NewComb THEN BEGIN
    Arrlen += 1;
    DimArr[1][Arrlen] := DtldVendLedgEntry2."Initial Entry Global Dim. 1";
    DimArr[2][Arrlen] := DtldVendLedgEntry2."Initial Entry Global Dim. 2";
    TotalAmtMD[Arrlen] += DtldCVLedgEntryBuf."Amount (LCY)";
    TotalAmtAddCurMD[Arrlen] += DtldCVLedgEntryBuf."Additional-Currency Amount";
    // End of the added lines.

    END;
    ...

    Existing code 6

    ...
    END;
    ...

    Replacement code 6

    ...
    END;

    // Add the following lines.
    IF DtldCVLedgEntryBuf."Entry Type" = DtldCVLedgEntryBuf."Entry Type"::Application THEN BEGIN
    IF DtldCVLedgEntryBuf."Amount (LCY)" >= 0 THEN BEGIN
    PositiveLCYAppAmt := PositiveLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    PositiveACYAppAmt :=
    PositiveACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END ELSE BEGIN
    NegativeLCYAppAmt := NegativeLCYAppAmt + DtldCVLedgEntryBuf."Amount (LCY)";
    NegativeACYAppAmt :=
    NegativeACYAppAmt + DtldCVLedgEntryBuf."Additional-Currency Amount";
    END;
    END;
    // End of the added lines.

    Existing code 7

    ...
    IF (TotalAmountLCY <> 0) OR

    // Delete the following lines.
    (TotalAmountAddCurr <> 0) AND (GLSetup."Additional Reporting Currency" <> '')
    THEN BEGIN
    HandlDtlAddjustment(DebitAddjustment,DebitAddjustmentAddCurr,CreditAddjustment,CreditAddjustmentAddCurr,
    TotalAmountLCY,TotalAmountAddCurr,VendPostingGr."Payables Account");
    InsertGLEntry(TRUE);
    // End of the deleted lines.

    END;
    ...

    Replacement code 7

    ...
    IF NOT MultipleDimensions THEN BEGIN

    // Add the following lines.
    IF (TotalAmountLCY <> 0) OR
    (TotalAmountAddCurr <> 0) AND (GLSetup."Additional Reporting Currency" <> '')
    THEN BEGIN
    InitGLEntry(VendPostingGr."Payables Account",TotalAmountLCY,TotalAmountAddCurr,TRUE,TRUE);
    InsertGLEntry(TRUE);
    END;
    END ELSE BEGIN
    FOR i := 1 TO Arrlen DO BEGIN
    IF (TotalAmtMD[i] <> 0) OR
    (TotalAmtAddCurMD[i] <> 0) AND (GLSetup."Additional Reporting Currency" <> '')
    THEN BEGIN
    GenJnlLine."Shortcut Dimension 1 Code" := DimArr[1][i];
    GenJnlLine."Shortcut Dimension 2 Code" := DimArr[2][i];
    InitGLEntry(VendPostingGr."Payables Account",TotalAmtMD[i],TotalAmtAddCurMD[i],TRUE,TRUE);
    InsertGLEntry(TRUE);
    END;
    END;
    // End of the added lines.

    END;
    ...
  4. Add the following function to CustEntry-Apply Posted Entries Codeunit (226):

    PROCEDURE MultipleDimensions@1170000000(Dim1Code@1170000000 : Code[10];Dim2Code@1170000001 : Code[10];VAR DtldCustLedEntry@1170000002 : Record 379) : Boolean;
    BEGIN
    DtldCustLedEntry.SETFILTER("Initial Entry Global Dim. 1",'<>%1',Dim1Code);
    IF DtldCustLedEntry.FINDFIRST THEN BEGIN
    DtldCustLedEntry.SETRANGE("Initial Entry Global Dim. 1");
    EXIT(TRUE);
    END;
    DtldCustLedEntry.SETRANGE("Initial Entry Global Dim. 1");
    DtldCustLedEntry.SETFILTER("Initial Entry Global Dim. 2",'<>%1',Dim2Code);
    IF DtldCustLedEntry.FINDFIRST THEN BEGIN
    DtldCustLedEntry.SETRANGE("Initial Entry Global Dim. 2");
    EXIT(TRUE);
    END;
    DtldCustLedEntry.SETRANGE("Initial Entry Global Dim. 2");
    EXIT(FALSE);
    END;
  5. Add the following function to VendEntry-Apply Posted Entries Codeunit (227):

    PROCEDURE MultipleDimensions@1170000000(Dim1Code@1170000000 : Code[10];Dim2Code@1170000001 : Code[10];DtldVendLedEntry@1170000002 : Record 380) : Boolean;
    BEGIN
    DtldVendLedEntry.SETFILTER("Initial Entry Global Dim. 1",'<>%1',Dim1Code);
    IF DtldVendLedEntry.FINDFIRST THEN BEGIN
    DtldVendLedEntry.SETRANGE("Initial Entry Global Dim. 1");
    EXIT(TRUE);
    END;
    DtldVendLedEntry.SETRANGE("Initial Entry Global Dim. 1");
    DtldVendLedEntry.SETFILTER("Initial Entry Global Dim. 2",'<>%1',Dim2Code);
    IF DtldVendLedEntry.FINDFIRST THEN BEGIN
    DtldVendLedEntry.SETRANGE("Initial Entry Global Dim. 2");
    EXIT(TRUE);
    END;
    DtldVendLedEntry.SETRANGE("Initial Entry Global Dim. 2");
    EXIT(FALSE);
    END;


Prerequisites

You must have one of the following products installed to apply this hotfix:

  • Microsoft Dynamics NAV 2009 R2

  • Microsoft Dynamics NAV 2009 Service Pack 1

Removal information

You cannot remove this hotfix.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Usefor other considerations.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×