Counting journal is used to modify the on hand inventory of an item with dimension wise. you can create it from Inventory management / Journals /Item Counting / Counting by front end.
you can also create and post this journal using x++ as well whenever it is require by using below job
static void CreateCountingJournal(Args _args)
{
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;
InventDim inventDim;
InventTable inventTable;
JournalCheckPost inventJournalCheckpost;
InventQtyJournal journalQty;
InventJournalName inventJournalName;
JournalNameId countingJournalNameId;
ItemId itemId;
try
{
//Initialization - Start
countingJournalNameId = "WH_COUNT";
itemId = "0000010";
journalQty = 21;
inventDim.InventSiteId = "SiteId"; //SiteId
inventDim.InventLocationId = "001"; //Warehouse id
inventDim.wMSLocationId = "E1-06-01"; //Location id
inventDim.LicensePlateId = "Test001";
//Specify any other dimension if any
inventDim = InventDim::findOrCreate(inventDim);
//Initialization - End
//Creation of header - Start
InventJournalName = InventJournalName::find(countingJournalNameId);
inventJournalTable.clear();
inventJournalTable.initFromInventJournalName(inventJournalName);
inventJournalTable.NumOfLines = 1;
inventJournalTable.insert();
//Creation of Header - End
//Creation of Lines - start
inventJournalTrans.clear();
inventJournalTrans.TransDate = systemdateget();
inventJournalTrans.initFromInventJournalTable(inventJournalTable);
inventJournalTrans.initValue();
inventTable = InventTable::find(ItemId);
inventJournalTrans.ItemId = inventTable.ItemId;
inventJournalTrans.InventDimId = inventDim.inventDimId;
inventJournalTrans.inventMovement().journalSetItemId(inventDim);
inventJournalTrans.Qty = journalQty; //Curent onhand qty
//inventJournalTrans.Counted = 0 Currently counted qty
inventJournalTrans.inventMovement().journalSetQty();
inventJournalTrans.insert();
//Creation of lines - End
//Posting of journal - Start
inventJournalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
inventJournalCheckpost.run();
//Posting of Journal - End
}
catch(Exception::CLRError)
{
info(AifUtil::getClrErrorMessage());
}
catch(Exception::Error)
{
info("Error");
}
}