Automatically Updating the counting period

I’m trying to change/fix the item journals so that the counting period updates automatically. I’m in CodeUnit 23(Item Jnl.-Post Batch) and I have a message box so I know it is trying to run. It updates the last phys.invt. date but doesn’t change the next counting period. This is the code:

IF SKUTable.GET(ItemJnlLine3.“Location Code”, ItemJnlLine3.“Item No.”, ItemJnlLine3.“Variant Code”) THEN BEGIN

MESSAGE(‘trying to update the counting period’);

PhysInvtCountMgt.SetHideValidationDialog(FALSE);

PhysInvtCountMgt.UpdateSKUPhysInvtCount(SKUTable);

END;

But if I go to the stockkeeping card and click functions calculate counting period it updates the next counting period. It looks like that button runs teh UpdateSKUPhysInvCount function, just on the rec from the sku card form. Is SKUTable not the same thing? Thanks for your help.

I see what was wrong, I needed to CALCFIELDS the “Last Phys. Inv Date” and then things starting to happen :slight_smile: