Post Journal in MSD axapta using x++ code

To post Journal in Microsoft dynamics axapta you can try following code.

 InventJournalTable   _inventJournalTable;  
  InventJournalCheckPost Class_journalCheckPost;    
  ;  
  ttsbegin;  
  _inventJournalTable = InventJournalTable::find("JV0000124",true);  
  _inventJournalTable.SystemBlocked = true;  
  _inventJournalTable.update();  
 Class_journalCheckPost  = InventJournalCheckPost::newJournalCheckPost (JournalCheckPostType::Post,_inventJournalTable);  
  Class_journalCheckPost.run();  
 _inventJournalTable.SystemBlocked = false;  
  _inventJournalTable.update();  
  ttscommit;  

In above code JournalCheckpost is standard axapta class which used to post journal. Your journal should be unblocked to post successfully.