Dataport and Dimension NAV 5.01


I try to import data from a dataport to a general journal

After the line insertion, i run codeunit Gen. Jnl.-Check Line to check the data but i get an error message "A dimension used in has caused an error… Select a dimension value code for the dimension…

If i delete the line “run codeunit Gen…” it works

Has anybody got an idea ?

Thanks in advance


Code :

“Gen. Journal Line”.Description := AnsiToAscii.Ansi2Ascii(COPYSTR(Desc,1,50));

IF Dim1 <> ‘’ THEN
“Gen. Journal Line”.VALIDATE(“Shortcut Dimension 1 Code”,Dim1);
IF Dim2 <> ‘’ THEN
“Gen. Journal Line”.VALIDATE(“Shortcut Dimension 2 Code”,Dim2);
IF Dim3 <> ‘’ THEN
“Gen. Journal Line”.ValidateShortcutDimCode(3,Dim3);

InsertLogDesc('Ligne avec montant = 0 → ',FORMAT(LineNo));

“Gen. Journal Line”.INSERT(TRUE);
lineInsert := lineInsert + 1;

CODEUNIT.RUN(CODEUNIT::“Gen. Jnl.-Check Line”,“Gen. Journal Line”);

You need to understand your used dimensions first before you try to delete code…
Probably you did not validate the fields on importing like the rules of your dimension setup would suggets, so the appropriate journal line dimension value info has not been created? You cannot just dataport into a General Journal. You need to do some additional programming in the dataport, validating at least some fields to create the journal line dimension values.

No, it doesn’t. It just skips checks. Anyway it might allow you to take a closer look at the generated journal lines and MAYBE understand what’s wrong with your dimensions.


If i manually insert lines with the same dimension values in a general journal and then run CODEUNIT.RUN(CODEUNIT::“Gen. Jnl.-Check Line”,Rec) i obtain the same error message …


Yes, of course. You should check the rules you set for that dimension and g/l accounts.