create and post Invent Adjustment Journal

Hi All,

Is there anyone have idea about how to create and post Invent Adjustment Journal through x++??

Try this:

void CreateInventoryAdjustment()

{

AxInventJournalTable axInventJournalTable;

AxInventJournalTrans axInventJournalTrans;

InventJournalId inventJournalId;

InventDim newInventDim;

InventDim findInventDim;

boolean journalHeaderExist;

ttsBegin;

axInventJournalTable = new AxInventJournalTable();

axInventJournalTrans = new AxInventJournalTrans();

axInventJournalTable.parmJournalType(InventJournalType::LossProfit);

axInventJournalTable.parmJournalNameId(InventParameters::find().LossProfitJournalNameId);

axInventJournalTable.save();

inventJournalId = ‘’;

inventJournalId = axInventJournalTable.inventJournalTable().JournalId;

axInventJournalTrans.parmJournalId(inventJournalId);

axInventJournalTrans.parmTransDate(systemDateGet());

axInventJournalTrans.parmCostPrice(SalesPrice);

axInventJournalTrans.parmQty(SalesQty);

axInventJournalTrans.parmInventDimId(inventDimId);

axInventJournalTrans.parmItemId(ItemId);

axInventJournalTrans.save();

if (axInventJournalTrans.inventJournalTrans().RecId)

{

// Posting of inventory adjustment

InventJournalCheckPost::newPostJournal(axInventJournalTable.inventJournalTable()).run();

}

ttsCommit;

info(strFmt(“Inventory adjustment journal %1 is posted.”, inventJournalId));

}