CLEAR(rJournalLineDimension); rJournalLineDimension.VALIDATE(rJournalLineDimension."Table ID",81); rJournalLineDimension.VALIDATE(rJournalLineDimension."Journal Template Name" , rGenJournalLine."Journal Template Name"); rJournalLineDimension.VALIDATE(rJournalLineDimension."Journal Batch Name", rGenJournalLine."Journal Batch Name"); rJournalLineDimension.VALIDATE(rJournalLineDimension."Journal Line No.", rGenJournalLine."Line No."); rJournalLineDimension.VALIDATE(rJournalLineDimension."Allocation Line No.", 0); rJournalLineDimension.VALIDATE(rJournalLineDimension."Dimension Code", rGeneralLedgerSetup."Shortcut Dimension 3 Code" ); rJournalLineDimension.VALIDATE(rJournalLineDimension."Dimension Value Code",vAuxSD3C); WITH rJournalLineDimension DO BEGIN MESSAGE ('%1,%2,%3,%4,%5,%6,%7',FORMAT ("Table ID"),"Journal Template Name","Journal Batch Name", "Journal Line No.","Allocation Line No.","Dimension Code","Dimension Value Code"); END; IF (rJournalLineDimension.INSERT) THEN MESSAGE('Inserta OK');
Answers
What is the code for looping?
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
The primary key should be unique even is this number is always 0, because the "line. No." changes. :shock:
If I follow the standard the "Allocation Number" might be 0, so I can't take this as a chance.
However, if I increment this number, it inserts some dimensions correctly, but not the 1 and 2 dimension. So I think the problem could be here.
The code is for insert new lines in Gen Journal Line, from an Excel sheet.
As the Gen Journal Line only have shortcut for dimensions 1 and 2, I have to insert the others dimensions by code. But the dimension 1 and 2 are not correctly inserted, so
¿Does anybody know if in Navision Attain the dimension 1 and 2 are automatically inserted in the "Journal line dimension " table when you validate a journal line?
Thanks
You need to leave the "Line No." = 0 and use VALIDATE("Shortcut Dimension 1/2 Code",'Some value');. This saves the data in globals in the record-variable of table 81 until you do a INSERT(TRUE);
And remember : just BEFORE doing the INSERT(TRUE), you need to change the "Line No.".
PS : If you assign a number to "Line No." before doing the validates, this will save the dimensions directly to the table, BEFORE you do the INSERT(TRUE). Best is to do all at the same moment.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!