On the Phys. Inventory Report I can click the button "Calculate Inventory" which runs a report "Calculate Inventory" Report 790 and populates the Journal page with the values.
I need to be able to run this report from a codeunit so that we can then fetch the values from a webservice call
So far what I has is this:
ItemJournalLine."Document No." := '1'; ItemJournalLine."Posting Date" := 122021D; ItemJournalLine.SETRANGE("Journal Batch Name", 'DEFAULT'); ItemJournalLine.SETRANGE("Journal Template Name", 'PHYS. INVE'); Item.SETFILTER("Location Filter", '001'); Item.SETFILTER("Item Category Code", 'GOODS'); Item.SETFILTER(Blocked, 'No'); CalcQtyOnHand.InitializeRequest(122021D, '1', FALSE, FALSE); CalcQtyOnHand.SetItemJnlLine(ItemJournalLine); CalcQtyOnHand.USEREQUESTPAGE(FALSE); //TODO: FALSE CalcQtyOnHand.SetHideValidationDialog(TRUE); CalcQtyOnHand.SETTABLEVIEW(Item); CalcQtyOnHand.RUNMODAL;
However when I run the code unit I get this error. (and of course the Phys. Inventory Journals is not populated with anything)
The Item Journal Template does not exist. Identification fields and values: Name=''
What do I need to do to select the Phys. Inventory Journals Page as the journal to populate?
Hello,
We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.
dynamicsuser.net/.../developers
I will open this up to the community in case they have something to add.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,522 Super User 2024 Season 2
Martin Dráb 228,441 Most Valuable Professional
nmaenpaa 101,148