Problem in posting Invoice -PO ax 2012


currently am working in ax 2012. i have created a purchase order through code. i have used purchformletter class.

my requirement is to create a pending invoice. I have used

"purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);

purchFormLetter.update(purchTable, strFmt("%1", purchTable.PurchId));"

this snippet of code successfully Post the Invoice. but i need to create pending invoice. can anyone help me to solve this issue.

thanks in advance