# Getting error while deleting PO Line, "SourceDocumentAmount object not initialized"

**URL:** <https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508>\
**Category:** User Forum\
**Created:** [April 24, 2016, 9:10am UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508 "2016-04-24T09:10:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muneeb](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Muneeb](https://www.dynamicsuser.net/u/Muneeb)\
**Post date:** [April 24, 2016, 9:10am UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/1 "2016-04-24T09:10:27Z")

</div>

Hi,

I am using AX 2012 R2 CU7. When I am trying to Delete the Purchase Order Line by clicking on “Remove” button, I am getting the below error:

* * *

SourceDocumentAmount object not initialized.

Stack trace

(S)\Classes\AccountingDistributionProcessor\initVariablesForMatching - line 8  
(S)\Classes\AccountingDistributionProcessor\processActionUpdate - line 52  
(S)\Classes\AccountingDistributionProcessor\processExistingDistributions - line 46  
(S)\Classes\AccountingDistributionProcessor\distribute - line 31  
(S)\Classes\AccountingDistributionProcessor\process - line 45  
(S)\Classes\AccountingDistributionProcessor\distributeSourceDocumentLineItem - line 66  
(S)\Classes\SourceDocumentLineState\distribute - line 17  
(S)\Classes\SourceDocumentLineStateDistributed\doMaintenance - line 11  
(S)\Classes\SourceDocumentStateBase\maintainState - line 22  
(S)\Classes\SourceDocumentStateBase\performTransitionOrMaintenance - line 15  
(S)\Classes\SourceDocumentLineState\performTransitionOrMaintenance - line 35  
(S)\Classes\SourceDocumentStateBase\transitionTo - line 15  
(S)\Classes\SourceDocumentProcessorBase\submit - line 11  
(S)\Classes\SourceDocumentLineProcessor\submitSourceDocumentLineImplementation - line 95  
(S)\Classes\SourceDocumentProcessorFacade\submitSourceDocumentLineImplementation - line 26  
(S)\Classes\PurchLineType\updateDistribution - line 9  
(S)\Classes\PurchLineType\deleteSoft - line 40  
(S)\Classes\PurchLineType\delete - line 122  
(S)\Classes\PurchLineType\_Purch\delete - line 21  
(S)\Data Dictionary\Tables\PurchLine\Methods\Delete - line 12  
(S)\Classes\xRecord\dbOpInTransaction  
(C)\Classes\FormDataSource\delete  
(C)\Forms\PurchTable\Data Sources\PurchLine\Methods\delete - line 24  
(C)\Classes\FormRun\task  
(C)\Classes\SysSetupFormRun\task - line 20

* * *

I have performed the Compile Forward and FULL CIL to all the above classes involved in the error but there are no errors. I have even debugged but as of now I am unable to catch the exact point. However, the code that is throwing the error is as shown in the below snapshot.

 ![CodeLine_ThrowingError.jpg](https://us1.discourse-cdn.com/flex023/uploads/dugusers/original/2X/6/6ff384556470fde8975590cea409d5eeabbf1002.jpeg)

Just a thought that I observed, can it be data issue, as it is happening only for a particular PO and I am able to delete lines from other PO without any issues.

I tried to troubleshoot to look for data inconsistency but didnt get anything yet. I think I need to to troubleshoot more into data inconsistency for this particular PO. Any idea in this direction?

Any suggestion/help would be highly appreciated.

Sincerely,

Muneeb

---

<div class="post-metadata">

**Author:** ![kranthi](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@kranthi](https://www.dynamicsuser.net/u/kranthi)\
**Post date:** [April 25, 2016, 8:33am UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/2 "2016-04-25T08:33:46Z")

</div>

I think it is a data issue. Were you able to make the amount zero on the purchase line?

---

<div class="post-metadata">

**Author:** ![Muneeb](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Muneeb](https://www.dynamicsuser.net/u/Muneeb)\
**Post date:** [April 25, 2016, 8:53am UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/3 "2016-04-25T08:53:15Z")

</div>

[deleted]

---

<div class="post-metadata">

**Author:** ![Muneeb](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Muneeb](https://www.dynamicsuser.net/u/Muneeb)\
**Post date:** [April 25, 2016, 8:58am UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/4 "2016-04-25T08:58:15Z")

</div>

Hi Kranthi,

Yes, you are right. Even after deleting the Amount either from Unit Price or from Net Amount when I am opening the PO to edit, the amount again populates.

Moreover, when I am clicking in Remove button to delete the line, the amount from “Unit Price” and “Net Amount” field disappears. But when I toggle to other PO line, the amount in “Unit Price” and “Net Amount” fields appears again.

Sincerely,  
Muneeb

---

<div class="post-metadata">

**Author:** ![khaleel316k](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@khaleel316k](https://www.dynamicsuser.net/u/khaleel316k)\
**Post date:** [May 18, 2016, 7:59am UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/5 "2016-05-18T07:59:50Z")

</div>

I had the same issue, this solution work for me hope it works for you as well. Delivery dates should be same on header and line, on line view select the line and click the action button ‘Purchase order line’ and click ‘Delivery schedule’ and update the ‘Confirm delivery dates’ and click OK. Now you will be able to delete the line.

---

<div class="post-metadata">

**Author:** ![Muneeb](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Muneeb](https://www.dynamicsuser.net/u/Muneeb)\
**Post date:** [May 25, 2016, 6:27am UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/6 "2016-05-25T06:27:53Z")

</div>

Hi Khaleel,

I have checked, this “Delivery Schedule” is disabled in my scenario so cannot click on that.

Moreover, just verified, the Delivery Date on Header and Line is same.

-Muneeb

---

<div class="post-metadata">

**Author:** ![janak.talekar](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@janak.talekar](https://www.dynamicsuser.net/u/janak.talekar)\
**Post date:** [June 4, 2016, 1:30pm UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/7 "2016-06-04T13:30:15Z")

</div>

Hi Muneeb,  
I am getting the same issue while posting the Pending Vendor Invoice  
Did you get any solution for this above problem?

Please help.

Regards,  
Janak Talekar

---

<div class="post-metadata">

**Author:** ![Muneeb](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Muneeb](https://www.dynamicsuser.net/u/Muneeb)\
**Post date:** [June 4, 2016, 2:07pm UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/8 "2016-06-04T14:07:45Z")

</div>

Hi Janak,

I think your issue seems to be different as this is related to Deleting of PO lines and your issue seems to be difference.

Are you invoicing through Invoice Pools in AP Module?

Can you please create a different thread for your question.

Sincerely,  
Muneeb

---

<div class="post-metadata">

**Author:** ![janak.talekar](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@janak.talekar](https://www.dynamicsuser.net/u/janak.talekar)\
**Post date:** [June 4, 2016, 2:09pm UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/9 "2016-06-04T14:09:30Z")

</div>

ok sure.

Thanks.

Regards,  
Janak

---

<div class="post-metadata">

**Author:** ![jpedersen](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@jpedersen](https://www.dynamicsuser.net/u/jpedersen)\
**Post date:** [March 23, 2017, 3:20pm UTC](https://www.dynamicsuser.net/t/getting-error-while-deleting-po-line-sourcedocumentamount-object-not-initialized/60508/10 "2017-03-23T15:20:21Z")

</div>

I’m getting the same error. I’m desperately trying to find a solution to this issue. Have you found a fix for this?

Sincerely,  
Jodie
