General ledger entry insertion from CAL

i want to set dimension code for transactions passed without it and before it is forced and the code below couldn’t do it,what is wrong with it,what did i miss.

GLE.SETRANGE(“Posting Date”,010115D,010515D);
GLE.SETFILTER(GLE.“Global Dimension 1 Code”,’ ');
IF GLE.FINDSET THEN
REPEAT
GLE.“Global Dimension 1 Code”:=‘012’;
GLE.Modify;
UNTIL GLE.NEXT = 0;

it depends on what version of NAV you are using. If you are using older version of NAV then you have to insert into ledger entry dimension table along with gl entry and if you are using newer version of NAV then you have to get the Dimension set and then insert into G/L entry.

NAV 2015 Ver.

You should also consider updating other tables involved in these transactions in order to preserve your data integrity.

It’s too detailed to write hence follow the below blog, don’t worry about the version its the same for 2015 and 2016.

check this blog
dynamicsuser.net/.../dimension-update-in-nav-2016

I hope you are not planning on inserting or changing G/L Entries directly???
As Babrown writes, then it will very easily destroy your data integrity. It’s an absolute “no-go” to do something like this (unless its to fix an error etc.).
The “ONLY WAY” to insert G/L entries is to use Codeunit 12!
Here you define your Gen. Journal Lines and then post them with CU 12.

HI Erik
Actually i was practicing closing the fiscal year on a separate test database i set up and it was complaining about empty cost center code and i was trying to insert cost center code to this transactions which posted without it and done with the closing.Thanks for your comment i will try your suggestion.