Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Adding Demensions on Physical Inventory Journal

(0) ShareShare
ReportReport
Posted on by 505

Hi, 
On the Physical Inventory Journal the Dimensions per line is added with the "Calculate Inventory" action.  The only dimensions that are added are the default dimensions from the item.  Our client requested the location code dimensions be added to the dimensions of Physical Inventory Journal lines. The problem is that we need to recreate the dimension set ID for each location code and item combination. 

How can I check the if there is a location and Item combination on the "Dimension Set Entry" table if it exists assign the Dimesion Set ID to the Physical Inventory Journal Line if it does not create a new Dimensions Set ID. I was thinking of doing this after the Item Journal Line is created. 

Many thanks

  • Suggested answer
    Hein Kruger Profile Picture
    Hein Kruger 505 on at
    RE: Adding Demensions on Physical Inventory Journal

    Here is my solution. 
    The Solution was made simple by the procedure (GetDimensionSetID) in the codeunit Dimension Management. This Procedure handles generating a new Dimension Set ID as well has checking if the combination of Dimension Set Entries already exist. 
    All we needed to do was to add the Dimensions we wanted in a temporary Dimension Set Entry and send the Temporary Dimension Set Entry to the (GetDimensionSetID) AFTER the Item Jnl Line has been created. 

    Take Note: The relationship between the values and the combination are one-to-one. If your Item has a dimension AREA and your location also has a Dimension AREA the insert will error. 

    local procedure OnAfterFunctionInsertItemJnlLine(var ItemJournalLine: Record "Item Journal Line")
        var
            TempDimensionSetEntry: Record "Dimension Set Entry" temporary;
            DimesionManagement: Codeunit DimensionManagement;
            DefaultDimension: Record "Default Dimension";
            DimensionValue: Record "Dimension Value";
            RecRef: RecordRef;
            Location: Record Location;
            Item: Record Item;
        begin
            If Item.Get(ItemJournalLine."Item No.") then begin
                DefaultDimension.Reset();
                DefaultDimension.SetRange("Table ID", Database::Item);
                DefaultDimension.SetRange("No.", Item."No.");
                if DefaultDimension.FindSet() then
                    repeat
                        DimensionValue.Get(DefaultDimension."Dimension Code", DefaultDimension."Dimension Value Code");
                        TempDimensionSetEntry.Init();
                        TempDimensionSetEntry.Validate("Dimension Code", DefaultDimension."Dimension Code");
                        TempDimensionSetEntry.Validate("Dimension Value Code", DefaultDimension."Dimension Value Code");
                        TempDimensionSetEntry."Dimension Value ID" := DimensionValue."Dimension Value ID";
                        TempDimensionSetEntry.Insert();
                    until DefaultDimension.Next() = 0;
            end;
            if Location.Get(ItemJournalLine."Location Code") then begin
                DefaultDimension.Reset();
                DefaultDimension.SetRange("Table ID", Database::Location);
                DefaultDimension.SetRange("No.", Location.Code);
                if DefaultDimension.FindSet() then
                    repeat
                        DimensionValue.Get(DefaultDimension."Dimension Code", DefaultDimension."Dimension Value Code");
                        TempDimensionSetEntry.Init();
                        TempDimensionSetEntry.Validate("Dimension Code", DefaultDimension."Dimension Code");
                        TempDimensionSetEntry.Validate("Dimension Value Code", DefaultDimension."Dimension Value Code");
                        TempDimensionSetEntry."Dimension Value ID" := DimensionValue."Dimension Value ID";
                        if TempDimensionSetEntry.Insert() then;
                    until DefaultDimension.Next() = 0;
            end;
            ItemJournalLine."Dimension Set ID" := DimesionManagement.GetDimensionSetID(TempDimensionSetEntry);
            ItemJournalLine.Modify();
        end;
  • Jun Wang Profile Picture
    Jun Wang 7,443 Super User 2024 Season 2 on at
    RE: Adding Demensions on Physical Inventory Journal

    good to know this! then you might consider testing by creating SKU which I'm hoping could help.

    since a SKU is related to both the item and location. Try set up default dimension on item card, also set up dimension on location, create a SKU and check if both dimensions flows to the SKU.

  • Hein Kruger Profile Picture
    Hein Kruger 505 on at
    RE: Adding Demensions on Physical Inventory Journal

    Hi Appliwin, 
    There are a lot of changes in BC from NAV 2018. Dimesions on the Lcoation Card is one of them. See the picture attached for standard BC21. 

  • Jun Wang Profile Picture
    Jun Wang 7,443 Super User 2024 Season 2 on at
    RE: Adding Demensions on Physical Inventory Journal

    I see there is no Dimension for a location for NAV 2018 and doubt BC has it. Do you know why the client is requesting it?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans