I have a request to populate the entries for the previous 3 months with a new Dimension CUSTDIM
All the Customers have a default dimension = to the Customer No.
It seems I need to create a new dimension set ID for each new instance, the existing entries have 2 dimensions and will end up with 3, the G/L Entry will have a new Dimension Set ID.
My code works (a report) for a single G/L Entry but if I use the Document No. as the filter when running the report (3 G/L Entries), I get an error.
"The Dimension Set Entry already exists. Identification fields and values: Dimension Set ID='3596', Dimension Code='Project''."
Report
DataItemTable G/L Entry
SORTING(Entry No.) WHERE(Source Type=CONST(Customer))
G/L Entry - OnAfterGetRecord()
CLEAR(Dimvalue);
GLEntry.GET("Entry No.");
IF GLEntry."Source No." <> '' THEN BEGIN
// Get current DimSet entries
DimMgt.GetDimensionSet(TmpDimensionSetEntry,GLEntry."Dimension Set ID");
IF Dimvalue.GET('CUSTDIM',GLEntry."Source No.") THEN BEGIN
// check if CUSTDIM exists
TmpDimensionSetEntry.SETRANGE("Dimension Code",Dimvalue."Dimension Code");
IF TmpDimensionSetEntry.FIND('-') THEN
CurrReport.SKIP;
// Add CUSTDIM
TmpDimensionSetEntry.INIT;
TmpDimensionSetEntry."Dimension Code" := Dimvalue."Dimension Code";
TmpDimensionSetEntry."Dimension Value Code" := Dimvalue.Code;
TmpDimensionSetEntry."Dimension Value ID" := Dimvalue."Dimension Value ID";
TmpDimensionSetEntry.INSERT;
// create a new entry in Table 480
GLEntry."Dimension Set ID" := DimMgt.GetDimensionSetID(TmpDimensionSetEntry);
GLEntry.MODIFY;
END;
END;
TmpDimensionSetEntry.DELETE;
Experience is what you get when you hoped to get money
0
Answers