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

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.

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

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

[deleted]

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

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.

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

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

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

ok sure.

Thanks.

Regards,
Janak

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