title: AX 2012 Vendor Prepayments Posting
body: <p>There is a new feature called Vendor Prepayments in AX 2012. It basically allows a company to prepay a vendor before the receipt of any goods. This was not there in AX 2009. So a user can basically attach a Prepayment record to a Purchase order and then post something called Prepayment invoice. When goods finally arrive, this Prepayment invoice is then applied to the "Real" Vendor invoice and settled. Its pretty straightforward and i guess logical.</p>
  
  <p>My requirement is to do this Prepayment Invoice posting by code in X++.</p>
  
  <p>If i try to use the PurchFormLetter class like below, it will post the Real invoice, which wont be correct as in the case of prepayments, there is no inventory transactions.</p>
  
  <pre><code>purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
  purchFormLetter.update(purchTable,
                         '8001',
                         systemDateGet(),
                         PurchUpdate::All,
                         AccountOrder::None,
                         NoYes::No,
                         NoYes::Yes);
  </code></pre>
  
  <p>I have looked around in AX Dev Guides, on google, on blogs but no help. </p>
  
  <p>Does anybody know this?</p>