populating fields for shortcut dimension 3 and 4

kikkomankikkoman Member Posts: 57
hello everyone,

i need to create a customization where the client uses Shortcut Dimension 3 and 4 default values. I have set up those dimensions and values. Now, I have a new customized table where the customer would like that functionality used. For this new table, a field in that table was also added to the Sales Line table. So now, when a user enters a value into that field on the Sales Line table or another table, the shortcut dim 3 and 4 need to populate the line.

I don't have a great understanding of the dimensions and so i need some help. i know that in native navision, when you specify defaults for Global Dimension 1 and 2 and then for example choose a Resource No. field on a Sales Line, then code is written to populate the line's Global dim 1 and 2 fields. i need this same functionality, but for dim 3 and 4. i have looked at the code where there are calls to different functions in codeunit 408 (DimensionManagement) but can't quit grasp everything. i know you have to insert records into the correct dimension tables (journal line dimension or document dimension) and then update the line, so i guess that's a start? i guess it's confusing to know which CU 408 functions to call, not really sure..

i was however able to add default dimensions to my newly created table in the Default Dimensions table by going into CU 408 and modifying function SetupObjectNoList(...) by changing variable array TableIDArray[] from 20 elements to 21 for my customized field. This had to be done because you need to include your object table in here or else you will never be able to insert records into the Default Dimension table b/c there is NO reference to your tableID.
(codeunit 408 DimensionManagement)
SetupObjectNoList(VAR TempObject : TEMPORARY Record Object)
NumberOfObjects := 21;
TableIDArray[21] := DATABASE::"my new table";

so, could anybody give me some insight as to how to approach this, or maybe even a explanation or document that explains dimensions in greater detail, maybe even the codeunit's functions. so that i can have a better understanding on this.

thanks in advance,[/code]


  • Options
    tguptatgupta Member Posts: 86
    G'day Kikkoman ,
    You can do something like this on the validate of your field which u added on the sales line.

    Put some setranges on the default dimension table to get the values
    then put some filter on the current lines in the sales line and insert the dimension values which u looking for .
    Have a look at the Tabel 175 standard vendor purchase code their is a function called updatedim thats a gud starting point to look for .
    If u still have trouble post the code which u write .

    Many Thanks,
    Tarun Gupta
  • Options
    kikkomankikkoman Member Posts: 57
    thanks for the reply tgupta, but i figured it out last week. \:D/

    i just used the fn CreateDim(...) from table Sales Line and then copied it but only passed 2 parameters, which are for my new table and field no., and then wrote code in my new field OnValidate to call this new function CreateDimNewField(...). It does exactly the same thing that the native fn CreateDim() does except it will only retrieves the default dims for my field and then places those fields in the document dimension table. the native navision code is called in another OnValidate() trigger, but i needed to create the new fn for my new field.

    thanks for the help though! much appreciated!!!
Sign In or Register to comment.