errors when post invoice using X++

Dear all,

Greetings, A very good day for you, I am using that code in blow to post invoice

purchTabl = PurchTable::find(dS_ConsignmentDetail.PurchId);
purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
purchFormLetter.update(purchTabl,dS_ConsignmentDetail.DS_Invoice,systemdateget(),
PurchUpdate::Recorded,
AccountOrder::None,
NoYes::No,
NoYes::Yes,NoYes::Yes);

but i was working good but suddenly , i received many errors in the following :-

1-Multiple lines on invoice Invoice-H-9 refer to the same purchase order line

2-A purchase order cannot be updated by separate lines on the same invoice.
Either combine the invoice lines, or move one to a separate invoice.

3-Invoice Invoice-H-9 was already used on date 13/10/2011.

4- Update of purchase order 00000129_069 canceled

i do not know why this done although i select the invoice from “LedgerJornalTrans” ,and i am sure i register it in “Invoice Register Form” why does feel with duplication ? , please help me ASAP ,many thanks.

Regards,

Hisham.