static void CreateAndPostTransferJournal(Args _args)
{
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;
JournalCheckPost inventJournalCheckPost;
NumberSeq num;
boolean _throwserror=true;
boolean _showinforesult=true;
InventDim frominventDim,ToinventDim;
;
ttsbegin;
inventJournalTable.clear();
num = new NumberSeq();
num = NumberSeq::newGetNum
(InventParameters::numRefTransferId());
inventJournalTable.initFromInventJournalName(InventJournalName::find
(InventParameters::find().TransferJournalNameId));
inventJournalTable.Description = ‘Inventory Transfer Journal’;
inventJournalTable.SystemBlocked = true;
inventJournalTable.insert();
inventJournalTrans.clear();
inventJournalTrans.initFromInventJournalTable(inventJournalTable);
inventJournalTrans.ItemId = ‘1000’;
frominventDim.InventLocationId=’11’;
frominventDim.inventSiteId =’1′;
ToinventDim.InventLocationId = ’13’;
ToinventDim.InventSiteId = ‘1’;
ToinventDim = InventDim::findOrCreate(ToinventDim);
frominventDim = InventDim::findOrCreate(frominventDim);
inventJournalTrans.InventDimId = frominventDim.inventDimId;
inventJournalTrans.initFromInventTable(InventTable::find(‘1000’));
inventJournalTrans.Qty = 10;
inventJournalTrans.ToInventDimId = ToinventDim.inventDimId;
inventJournalTrans.TransDate = SystemDateget();
inventJournalTrans.insert();
inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost(JournalCheckpostType::Post,inventJournalTable);
inventJournalCheckPost.parmThrowCheckFailed(_throwserror);
inventJournalCheckPost.parmShowInfoResult(_showinforesult);
inventJournalCheckPost.run();
//inventJournalTable.SystemBlocked = false;
//inventJournalTable.update();
ttscommit;
info(inventJournalTrans.JournalId);
}

http://blog.slcconsulting.us/2011/12/posting-a-transfer-order-using-x/