I am writing a processing report to populate a batch in the General Journal. I am having difficulty populating a dimension code field pulling data from a table. This is an example of what I have: GenJnl.Amount := “Some Amount”.OverShort; GenJnl.VALIDATE(Amount); GenJnl."Shortcut Dimension 3 Code := “Table Data”.Field;[/hl] GenJnl.Description := ‘some description’; What am I missing? Thanks
Hi, before GenJnl."Shortcut Dimension 3 Code := “Table Data”.Field; write GenJnl.INSERT; then validate the Dimensions then system will automatically creates the Journal Line Dimensions, so in your case : GenJnl.VALIDATE(“Shortcut Dimension 3 Code”,“Table Date”.FIeld); GenJnl.MODIFY; it should work…
Hi You can also write the journal line dimension entry directly. if the journal line dimension table is declared as a variable then lJnlLineDim.INIT; lJnlLineDim.“Table ID” := 81; // the general journal line table lJnlLineDim.“Journal Template Name” := General Journal Name; lJnlLineDim.“Journal Batch Name” := Journal Batch Name; lJnlLineDim.“Journal Line No.” := Gerneral Journal Line No.; lJnlLineDim.“Dimension Code” := A Dimension Code; lJnlLineDim.“Dimension Value Code” := Required Dimension Value; lJnlLineDim.INSERT;
Dave, I have an interesting problem I populate the Joural Line Dimension table and validate all the fields. WHen a look at the journal line afterwards, not all the Shortcut Dimensions appear on the Journal line, however are in the Journal Line Dimension table… IF DefaultDimension.FIND(’-’) THEN REPEAT JournalLineDimension.RESET; JournalLineDimension.VALIDATE(JournalLineDimension.“Table ID”,81); JournalLineDimension.VALIDATE(JournalLineDimension.“Journal Template Name”,GenJnlLine.“Journal Template Name”); JournalLineDimension.VALIDATE(JournalLineDimension.“Journal Batch Name”,GenJnlLine.“Journal Batch Name”); JournalLineDimension.VALIDATE(JournalLineDimension.“Journal Line No.”,GenJnlLine.“Line No.”); JournalLineDimension.VALIDATE(JournalLineDimension.“Dimension Code”,DefaultDimension.“Dimension Code”); JournalLineDimension.VALIDATE(JournalLineDimension.“Dimension Value Code”,DefaultDimension.“Dimension Value Code”); JournalLineDimension.INSERT(TRUE); UNTIL DefaultDimension.NEXT = 0; ANY IDEAS WHY?
The fields that are not being populated are Global Dimension fields? why would those values not be on the Journal Line, but in the Journal Line Dimensions, if I go in and validate the same value, it appears on the Journal??
Marc, just a couple of comments to improve your code: 1) inserting the records on the journal line dimension table does not update all the dimension fields on the journal line itself, just the global ones are update via the OnInsert trigger. You’ll have to update the other dimensions via code, as described in a previous post. 2) there is not need to validate all fields of the journal line dimension, the VALIDATE function does 2 things - validate the related table if the field has a table relation and executes the code of the OnValidate trigger, if there is none of those two points there is no need to “VALIDATE”. Saludos Nils
Nils, I didn’t realize you were a CRM developer, but then again, the code looks so much like Navision, I guss its not that hard to learn. [:D]
I didn’t realize you were a CRM developer
Me neither, but I didn’t notice that many differences to Navision, so I gave it a try… Looks like they took Navision, cut out a lot of stuff and created CRM [;)] Saludos Nils