Alright, I was able to set the debugger on the post process. I get the error break in the GetValuationDate function @ OldValueEntry.SetRange("Entry Type") in code unit 22. It appears to recognize the error here first, then proceeds to code unit 5895> CalcInbndEntryAdjustedCost, Where it sends the error message box to the screen when it errors on line InbndItemLedgEntry.GET(InbndItemLedgEntryNo):
It seems to be looking for the last entry number and using that as a comparison.
Here is a copy of the code with the error lines highlighted:
.
. Code Unit 22
GetValuationDate(VAR ValueEntry : Record "Value Entry";OldItemLedgEntry : Record "Item Ledger Entry")
WITH OldItemLedgEntry DO BEGIN
OldValueEntry.SETCURRENTKEY("Item Ledger Entry No.","Entry Type");
OldValueEntry.SETRANGE("Item Ledger Entry No.","Entry No.");
OldValueEntry.SETRANGE("Entry Type",OldValueEntry."Entry Type"::Revaluation);
IF NOT OldValueEntry.FINDLAST THEN BEGIN
OldValueEntry.SETRANGE("Entry Type");
OldValueEntry.FINDLAST;
END;
IF Positive THEN BEGIN
IF (ValueEntry."Posting Date" < OldValueEntry."Valuation Date") OR
(ItemJnlLine."Applies-to Entry" <> 0)
THEN BEGIN
ValueEntry."Valuation Date" := OldValueEntry."Valuation Date";
SetValuationDateAllValueEntrie(
ValueEntry."Item Ledger Entry No.",
OldValueEntry."Valuation Date",
ItemJnlLine."Applies-to Entry" <> 0)
END ELSE BEGIN
ValueEntry."Valuation Date" := ValueEntry."Posting Date";
SetValuationDateAllValueEntrie(
ValueEntry."Item Ledger Entry No.",
ValueEntry."Posting Date",
ItemJnlLine."Applies-to Entry" <> 0)
END
END ELSE
.
.Code Unit 5895
CalcInbndEntryAdjustedCost(VAR AdjustedCostElementBuf : Record "Cost Element Buffer";ItemApplnEntry : Record "Item Application Entry";OutbndItemLedgEntryNo : Integer;InbndItemLedgEntryNo : Integer;ExactCostReversing : Boolean;Recursion : Boolean) : Boolean
AdjustedCostElementBuf.DELETEALL;
WITH InbndValueEntry DO BEGIN
InbndItemLedgEntry.GET(InbndItemLedgEntryNo);
SETCURRENTKEY("Item Ledger Entry No.");
SETRANGE("Item Ledger Entry No.",InbndItemLedgEntryNo);
QtyNotInvoiced := InbndItemLedgEntry.Quantity - InbndItemLedgEntry."Invoiced Quantity";
FINDSET;