The Ledger Entry Dimension already exists.

ducnguyenducnguyen Member Posts: 8
I try to create a codeunit to post a payment by payment journal but I facing an error:
The Ledger Entry Dimension already exists. Identification fields and values: Table ID='271',Entry No.='2788',Dimension Code='DEPARTMENT'

Any advice?
Thank you so much.

Answers

  • kabrocokabroco Member Posts: 111
    What do you do with TempJnlLineDim?
  • ducnguyenducnguyen Member Posts: 8
    edited 2016-09-08
    kabroco wrote: »
    What do you do with TempJnlLineDim?

    It's just a variable with datatype = Record, subType = Journal Line Dimension
  • Theunis_ModdermanTheunis_Modderman Member Posts: 9
    Have you checked which is the last Bank Account Ledger Entry in your database? It should be 2787 (since apparently running this code creates Entry No. 2788). Next, also check the Ledger Entry Dimension table...there should exist no records for Table-ID=271, Entry No.=2788. If that is the case, maybe someone deleted a Bank Account Ledger Entry without deleting the attached Ledger Entry Dimensions...I would check this first, since your code seems to be OK.
    Theunis Modderman
    DSA Global Solutions bv
    Hoofddorp- The Netherlands

    t. +31 - 23 737 0 484
    m. http://www.dsa-gs.nl
  • ducnguyenducnguyen Member Posts: 8
    edited 2016-11-04
    Thank for your comment Theunis :)
    I just check data in the database and saw anything to be OK. Please see attached:

    So I don't know why the reason for this issue (I use NAV 2009 R2). Please give me your advice :)
    Thank so much!
  • Theunis_ModdermanTheunis_Modderman Member Posts: 9
    Did you set the Property Temporary for your variable TempJnlLineDim to Yes? Did you check the Ledger Entry Dimension table for records linked to Table-ID 271 (your screenshot shows table 17...)

    By the way: your code is causing troubles anyhow. You are using a 'real' GenJnlLine-record, which you insert in Table 81. By validating the Account No. and Bank Account No., this will create (if applicable) also corresponding Journal Line Dimensions. These dimensions will however not be copied to the Ledger Entry Dimension-table, since that happens with the records in the TempJnlLineDim-=table. If you would e.g. have a Global Dimension 1or 2 linked to the Vendor or to the Bank account, these values would appear in your Ledger Entries (G/L, vendor, Bank Account) but not in your Ledger Entry Dimension tables. For example your Analysis View Entries would not match your G/L Entries. Better is to copy the Journal Line Dimensions to the TempJnlLineDim table...
    Theunis Modderman
    DSA Global Solutions bv
    Hoofddorp- The Netherlands

    t. +31 - 23 737 0 484
    m. http://www.dsa-gs.nl
  • ducnguyenducnguyen Member Posts: 8
    edited 2016-09-08
    Did you check the Ledger Entry Dimension table for records linked to Table-ID 271 (your screenshot shows table 17...)
    Yes, I did, no records linked to Table-ID 271.
    Did you set the Property Temporary for your variable TempJnlLineDim to Yes?
    No, I just update now and facing a new error:
    A dimension used in Gen. Journal Line PAYMENT, GENERAL, 20000 has caused an error. Select a Dimension Value Code for the Dimension Code AREA for Vendor 20000.

    Sorry I don't understand what you explain, I'm a newbie so many thank if you can help me resolve it.
  • Theunis_ModdermanTheunis_Modderman Member Posts: 9
    // First clear the temporary table
    TempJnlLineDim.DELETEALL;

    // Now copy all Journal Line Dimensions to the Temp-table
    JnlLineDim.RESET;
    JnlLineDim.setrange("Table ID",database::"81");
    JnlLineDim.setrange("Journal Template Name",GenJnlLine."Journal Template Name");
    JnlLineDim.setrange("Journal Batch Name",GenJnlLine."Journal Batch Name");
    JnlLineDim.setrange("Journal Line No.",GenJnlLine."Line No.");
    IF JnlLineDim.findset then
    repeat
    TempJnlLineDim := JnlLineDim;
    TempJnlLineDim.INSERT;
    until JnlLineDim.next = 0;

    GenJnlPostLine.RunWithCheck(GenJnlLine, TempJnlLineDim);


    By the way...this is not a training institute. You cannot expect people to write your code for you.
    Theunis Modderman
    DSA Global Solutions bv
    Hoofddorp- The Netherlands

    t. +31 - 23 737 0 484
    m. http://www.dsa-gs.nl
  • ducnguyenducnguyen Member Posts: 8
    By the way...this is not a training institute. You cannot expect people to write your code for you.

    Thanks Theunis. I'm don't expect who to write code for me, just hope have someone can give me a solution or something like that so I can resolve my issue :)
Sign In or Register to comment.