Easily work with dimensions
Goal
Dimensions in the respective sales, purchasing and financial data sets are to be displayed. Just as it happens with global dimension codes 1 + 2. Currently, the assigned dimensions can only be displayed via Navigate> Dimensions.
Idea
FlowFields are added that represent the dimensions configured in Financial Accounting as dimensions 3-8. FlowFilters are also created, which previously defined FlowFields with the right dimension filter on table 480.
Implementation
Table 348, Funktion CheckIfDimUsed
All entries in table 349 (DimensionValue) must have a valid value in the field „Global Dimenson No.“ according to the selection in table 98 (General Ledger Setup). Therefore, the following code was added at the end of the CheckIfDimUsed function:
IF (BudgetNameChecked=“) AND (AnalysisViewChecked=“) AND (AnalysisAreaChecked=0) THEN BEGIN
DimVal.RESET;
DimVal.SETRANGE(„Global Dimension No.“,DimTypeChecked);
IF DimVal.FINDSET THEN REPEAT
DimVal.“Global Dimension No.“ := 0;
DimVal.MODIFY;
UNTIL DimVal.NEXT=0;
IF DimChecked<>“ THEN BEGIN
DimVal.RESET;
DimVal.SETRANGE(„Dimension Code“,DimChecked);
IF DimVal.FINDSET THEN REPEAT
DimVal.“Global Dimension No.“ := DimTypeChecked;
DimVal.MODIFY;
UNTIL DimVal.NEXT=0;
END;
END;
Example on Table 36 (Sales Header)
Add new FlowFilter Dimension x Filter (x: 3..10) Code20.
Add FlowField Dimension x Code (x: 3..10) Code20.
CalcFormula (x: 3..10):
Lookup(„Dimension Set Entry“.“Dimension Value Code“ WHERE (Dimension Set ID=FIELD(Dimension Set ID),Dimension Code=FIELD(Dimension x Filter)))
CaptionClass (x: 3..10):
‚1,2,x‘
Editable :
No
TableRelation :
„Dimension Value“.Code WHERE (Global Dimension No.=CONST(x))
Create Global Function GetDimensionFilter, called once from each form:
//GenLedgerSetup : Table 98
GenLedgerSetup.GET();
SETFILTER(„Dimension 3 Filter“,GenLedgerSetup.“Shortcut Dimension 3 Code“);
SETFILTER(„Dimension 4 Filter“,GenLedgerSetup.“Shortcut Dimension 4 Code“);
SETFILTER(„Dimension 5 Filter“,GenLedgerSetup.“Shortcut Dimension 5 Code“);
SETFILTER(„Dimension 6 Filter“,GenLedgerSetup.“Shortcut Dimension 6 Code“);
Example on Page 42 (Sales Order, PageType Document)
Add new variable Dimx (x: 3..10) as Code20.
Create new Field
SourceExpr : Dimx (x: 3..10)
TableRelation : (x: 3..10)
„Dimension Value“.Code WHERE (Global Dimension No.=CONST(x))
Caption Class (x: 3..10)
‚1,2,x‘
OnValidate()-Trigger (x: 3..10):
ValidateShortcutDimensionCode(x,Dimx);
Call the new Function GetDimensionFilter inside OnAfterGetCurrentRecord.
Example on Page 9305 (Sales Order List, PageType List)
Create new Field Dimension x Code (x: 3..10).
Call the new Function GetDimensionFilter inside OnAfterGetCurrentRecord.
Watch out : CheckDim3to8