Invoice Posting

Dear All,

I was trying to post invoice through code. But i receive error for different purchase order number which was not sensible. But when i tried to post invoice through different system using the same code i can post the invoice successfully.

Below is the error msg i rcv:


Purchase order: PO-4828

Item: Pen

Update quantity is greater than remaining quantity on order line.

Can anyone suggest me what was wrong in my system?