Hi
We don't want the PostConsumption routine to stop because of some Items with product code "Screw", is not in inventory.
(sounds crazy but we want this way).
So I have done some changes in cu 22.
Before the routine InsertConsumpEntry called. I'll posting an Item Journal with quanity that needs.
Problem is when I posting from consumption journal, I'll get Ledger Entry Dimension Error
"Table Id:32 ,Entry No. 835556, Dimensionkod:Parts " is already exists.
All tips is welcome..
...
IF recItem."Product Group Code" = 'SCREW' THEN
BEGIN
recItem.CALCFIELDS(Inventory);
IF recItem.Inventory < QtyToPost THEN
InsertScrewsEntry(QtyToPost-recItem.Inventory,ProdOrderComp);
END;
IF ProdOrderCompModified THEN
InsertConsumpEntry(ProdOrderComp,"Line No.",QtyToPost,FALSE)
ELSE
.....
Have I missed something in my routine below?
InsertScrewsEntry(Qty : Decimal;ProdComp : Record "Prod. Order Component")
Commit;
Setup.get;
CLEAR(recItemJnlLine);
recItemJnlLine.SETRANGE("Journal Template Name",Setup."Journal Template Name");
recItemJnlLine.SETRANGE("Journal Batch Name",Setup."Journal Batch Name");
IF recItemJnlLine.FIND('-') THEN
recItemJnlLine.DELETEALL;
recItemJnlLine.INIT;
recItemJnlLine."Journal Template Name" := Setup."Journal Template Name";
recItemJnlLine."Journal Batch Name" := Setup."Journal Batch Name";
recItemJnlLine.SetUpNewLine(recItemJnlLine);
recItemJnlLine."Line No." := 10000;
recItemJnlLine.INSERT(TRUE);
recItemJnlLine.VALIDATE("Posting Date", TODAY);
recItemJnlLine.VALIDATE("Entry Type",recItemJnlLine."Entry Type"::"Positive Adjmt.");
recItemJnlLine.VALIDATE("Item No.", ProdComp."Item No.");
recItemJnlLine.VALIDATE(Quantity,Qty);
recItemJnlLine."Location Code" := ProdComp."Location Code";
recItemJnlLine.MODIFY;
COMMIT;
cuPost.SkipDialog(TRUE);
cuPost.RUN(recItemJnlLine); //''Cu 241
0
Comments
second why are you inserting the ItemJournal Line?
recItemJnlLine.INSERT(TRUE);
You should not use
cuPost.RUN(recItemJnlLine);
but instead use
cuPost.RUNWITHCHECK(recItemJnlLine,TempDIMENSION);
Also your code should not be called within posting of another Item journal
I suggest to call your code before calling standard NAV Posting routine. You should it from OnPush trigger of the form.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
U meant in form 99000846?