I want to copy the dimensions from Item ledger entry to Item journal. How can I get a new Dimension set ID for the Item journal line. Below is the code I have.
itemledg.reset;
itemledg.setrange("Posting date",PostingDate);
if itemledg.findset then begin
DimSetEntry.reset;
Dimsetentry.setrange("dimension set ID",itemledg."dimension set id");
if dimsetentry.findset then begin
repeat
Newdimsetentry.reset;
Newdimsetentry.init;
Newdimsetentry.transferfields(dimsetentry);
newdimsetentry."dimension set id" := getdimensionsetid(dimentry); (Which does not work)
Newdimsetentry.insert;
until dimsetentry.next = 0;
end;
end;
Code highlighted just does not work. I just want to get a new dimension set ID for the Item journal line.
Any help is highly appreciated.
RJ.
0
Comments
http://mibuso.com/blogs/davidmachanick/
OldDimSetID := "Dimension Set ID";
DimMgt.GetDimensionSet(TempDimSetEntry,OldDimSetID); //obtain list of existing purchase order dimensions
2. Insert new dimension to TempDimSetEntry
.......
3. Create new diemension set id
NewDimSetID := DimMgt.GetDimensionSetID(TempDimSetEntry); //get new DimSetID
IF OldDimSetID <> NewDimSetID THEN BEGIN
"Dimension Set ID" := NewDimSetID; //assign new DimSetID
DimMgt.UpdateGlobalDimFromDimSetID("Dimension Set ID","Shortcut Dimension 1 Code","Shortcut Dimension 2 Code");
END;