Skip to main content

Notifications

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

Posting Item Charges to Production Output Customization

Posted on by 26
Hi,
 
 
I want to do absorption costing to add some actual charges to production output using item charges.
 
Here is a sample of what i was trying to achieve however i get an error.
 
Has anyone customized item cahrges to post using journals?
 
var
                    ItemJnl: Record "Item Journal Line";
                    ItemJnlPostLine: Codeunit "Item Jnl.-Post Line";
                begin
                    ItemJnl.Init();
                    ItemJnl."Posting Date" := TODAY;
                    ItemJnl."Journal Template Name" := 'ITEM';
                    ItemJnl."Journal Batch Name" := 'DEFAULT';
                    ItemJnl."Document No." := 'Testing';
                    ItemJnl."External Document No." := 'test';
                    ItemJnl."Item No." := '1000';
                    ItemJnl.Validate("Item No.");
                    ItemJnl."Item Charge No." := 'JB-FREIGHT';
                    ItemJnl.Description := 'JB-FREIGHT';
                    ItemJnl."Document Line No." := 20000;
                    ItemJnl."Unit of Measure Code" := '';
                    ItemJnl.Quantity := 1;
                    ItemJnl."Qty. per Unit of Measure" := 1;
                    ItemJnl."Invoiced Quantity" := 1;
                    ItemJnl."Invoiced Qty. (Base)" := 1;
                    ItemJnl.Amount := 400;
                    ItemJnl."Unit Cost (ACY)" := 400;
                    ItemJnl."Unit Cost" := 400;
                    ItemJnl."Applies-to Entry" := 330;
                    ItemJnl."Gen. Prod. Posting Group" := 'SERVICES';
                    ItemJnl.Insert();
 
 
 
 
                    Message('Inserted');
 
                    //ItemJnlPostLine.RunWithCheck(ItemJnl);
 
                end;
 
The error
Error message: 
The Item Ledger Entry does not exist. Identification fields and values: Entry No.='0'

 
 
AL call stack: 
"Item Jnl.-Post Line"(CodeUnit 22).PostItem line 73 - Base Application by Microsoft
"Item Jnl.-Post Line"(CodeUnit 22).Code line 133 - Base Application by Microsoft
"Item Jnl.-Post Line"(CodeUnit 22).PostSplitJnlLine line 12 - Base Application by Microsoft
"Item Jnl.-Post Line"(CodeUnit 22).RunWithCheck line 16 - Base Application by Microsoft
"Item Jnl.-Post Batch"(CodeUnit 23).PostLines line 48 - Base Application by Microsoft
"Item Jnl.-Post Batch"(CodeUnit 23).Code line 56 - Base Application by Microsoft
"Item Jnl.-Post Batch"(CodeUnit 23).OnRun(Trigger) line 6 - Base Application by Microsoft
"Item Jnl.-Post"(CodeUnit 241).Code line 25 - Base Application by Microsoft
"Item Jnl.-Post"(CodeUnit 241).OnRun(Trigger) line 3 - Base Application by Microsoft
"Item Journal"(Page 40)."Post - OnAction"(Trigger) line 2 - Base Application by Microsoft
Categories:
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,536 Super User 2024 Season 2 on at
    Posting Item Charges to Production Output Customization
    Hi,
     
    Make sure that the the Item Ledger Entry table have a record where Entry No. = 330.
     
    Otherwise you can set 0 for Applies-to Entry.
     
     
    Best regards,
    Mohamed Amine MAHMOUDI

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans