Add a dimension programmatically

Per1008Per1008 Member Posts: 10
edited 2013-08-29 in NAV Three Tier
How do I add one or more dimension (480 - Dimension Entry Set) to a Gen. Journal Line programmatically?
It must be one line of code to be called ...

I can't find that one line of code - therefore I have tried:

DimensionSetEntryRec_L.VALIDATE("Dimension Code",<Code>);
DimensionSetEntryRec_L.VALIDATE("Dimension Value Code",<Value>);
DimensionSetEntryRec_L.INSERT(TRUE);
DimensionSetEntryRec_L.GetDimensionSetID(DimensionSetEntryRec_L);
DimSetID_L := DimensionManagementCU_L.GetDimensionSetID(DimensionSetEntryRec_L);
GenJournalLineRec_L."Dimension Set ID" := DimSetID_L;
GenJournalLineRec_L.MODIFY(TRUE);

It seems to Work for the first line I create, but not the NeXT one and the rest of the lines

Comments

  • BardurKnudsenBardurKnudsen Member, Microsoft Employee Posts: 137
    Put your values into a temp table of type 480: TempDimSetEntry
    Then call:
    NewDimID := DimMgt.GetDimensionSetID(TempDimSetEntry);

    The DimMgt.GetDimensionSetID will automatically add missing entries.
    Bardur Knudsen
    Microsoft - Dynamics NAV
Sign In or Register to comment.