SourceDocumentLineItem object not initialised error while choosing invoice on PO

Question Status

Unanswered
Venkat asked a question on 18 May 2018 5:42 AM

Hi All,

I am getting the error "SourceDocumentLineItem object not initialised. along with update has been cancelled" while I click the invoice button on invoice tab of the PO. The below is the stack trace which throws the error. The other purchase orders go through the process without the error. 

I also did full cil, full compile and aos restart but those did not solve the issue. Any chance that the parameters setting could cause the problem?

Stack trace

(S)\Classes\SourceDocumentLineItem\newFromSourceDocumentLineImplementation - line 27
(S)\Classes\SourceDocumentLineMatchingFacade\addSourceDocLineItemToList - line 34
(S)\Classes\PurchOrderLineSourceDocumentLineItem\initSourceDocumentLineMatchingList - line 51
(S)\Classes\SourceDocumentLineItem\parmSourceDocumentLineMatchingList - line 5
(S)\Classes\TaxSourceDocSublineItem\initSourceDocumentLineMatchingList - line 18
(S)\Classes\SourceDocumentLineItem\parmSourceDocumentLineMatchingList - line 5
(S)\Classes\TaxSourceDocSublineItem\calculateSourceDocumentAmountMap - line 57
(S)\Classes\SourceDocumentLineItem\parmSourceDocumentAmountMap - line 5
(S)\Classes\TaxSourceDocSublineItem\calculateSourceDocumentAmountMap - line 151
(S)\Classes\SourceDocumentLineItem\parmSourceDocumentAmountMap - line 5
(S)\Classes\AccountingDistributionProcessor\changeActiveSourceDocumentLineItem - line 32
(S)\Classes\AccountingDistributionProcessor\process - line 39
(S)\Classes\AccountingDistributionProcessor\distributeSourceDocumentLineItem - line 71
(S)\Classes\SourceDocumentLineState\distribute - line 17
(S)\Classes\SourceDocumentLineStateDraft\doTransition - line 12
(S)\Classes\SourceDocumentStateBase\transition - line 27
(S)\Classes\SourceDocumentStateBase\performTransitionOrMaintenance - line 7
(S)\Classes\SourceDocumentLineState\performTransitionOrMaintenance - line 36
(S)\Classes\SourceDocumentStateBase\transitionTo - line 15
(S)\Classes\SourceDocumentProcessorBase\submit - line 11
(S)\Classes\SourceDocumentLineProcessor\submitSourceDocumentLineImplementation - line 111
(S)\Classes\SourceDocumentLineState\submitChildSourceDocLineImplementation - line 15
(S)\Classes\SourceDocumentLineState\propagateStatusToChildren - line 37
(S)\Classes\SourceDocumentStateBase\transitionTo - line 23
(S)\Classes\SourceDocumentProcessorBase\submit - line 11
(S)\Classes\SourceDocumentLineProcessor\submitOnDemandSourceDocumentLine - line 70
(S)\Classes\SourceDocumentStateInProcess\callSourceDocumentLineProcessor - line 16
(S)\Classes\SourceDocumentStateInProcess\maintainSourceDocumentLines - line 34
(S)\Classes\SourceDocumentStateInProcess\doMaintenance - line 3
(S)\Classes\SourceDocumentStateBase\maintainState - line 22
(S)\Classes\SourceDocumentStateBase\performTransitionOrMaintenance - line 15
(S)\Classes\SourceDocumentStateBase\transitionTo - line 15
(S)\Classes\SourceDocumentProcessorBase\submit - line 11
(S)\Classes\SourceDocumentProcessor\submitOnDemandSourceDocumentImpl - line 46
(S)\Classes\SourceDocumentProcessorFacade\submitOnDemandSourceDocumentImpl - line 38
(S)\Classes\PurchFormletterParmDataInvoice\checkBudget - line 48
(S)\Classes\PurchFormletterParmDataInvoice\selectChooseLines - line 31
(S)\Classes\formletterParmData\createData - line 47
(S)\Classes\PurchFormletterParmDataInvoice\createData - line 3
(S)\Classes\PurchFormletterParmDataInvoice\chooseLinesServerIL - line 32
(S)\Classes\DictClass\callStatic
(S)\Classes\SysDictClass\invokeStaticMethod - line 26
(S)\Classes\SysDictClass\invokeStaticMethodIL - line 39
(S)\Classes\Global\runClassMethodIL - line 30
(S)\Classes\PurchFormletterParmDataInvoice\chooseLinesServer - line 21
(S)\Classes\PurchFormLetter_Invoice\chooseLinesServer - line 3
(S)\Classes\PurchFormLetter\chooseLines - line 26
(S)\Classes\PurchFormLetter_Invoice\chooseLines - line 10
(S)\Classes\PurchFormLetter\initLinesQuery - line 3
(S)\Classes\PurchFormLetter\prePromptInit - line 20
(S)\Classes\PurchFormLetter\mainOnServer - line 214
(C)\Classes\PurchFormLetter\main - line 50
(C)\Classes\FormFunctionButtonControl\Clicked

The below assertion fails as I get sourceDocumentLine is 0. and the error is caught and thrown.

Debug::assert(sourceDocumentLine.RecId != 0);

Thanks in advance.. 

Reply
Hossein Karimi responded on 19 May 2018 7:52 AM

Hi,

Run a full CIL compile and see if this solves your problem.

Regards Hossein

Reply
Venkat responded on 21 May 2018 2:34 AM

That doesn't solve the problem.

Reply
Hossein Karimi responded on 21 May 2018 4:32 AM

Hi,

Go to System Administration=>Periodic and Run below:

-Compile Application

-Compile into .Net Framework CIL

Regards Hossein

Reply
Jonathan Halland responded on 21 May 2018 7:32 AM

Hi.

I just received this this morning and it appears to be related to a source document line record whose parent document has been deleted. E.G. PurchLine.

My issue was with a a purchLine link. You could do a SQL query to find the missing records. e.g.

select * from SOURCEDOCUMENTLINE LEFT join purchline on SOURCEDOCUMENTLINE.RECID = purchLine.SOURCEDOCUMENTLINE

where SOURCERELATIONTYPE = 340 --PurchLine TableId

and purchLine.RECID is null

Deleting the relevant record sourcedocumentLine worked in a dev environment, but I haven't investigated further.

Reply
Venkat responded on 22 May 2018 5:05 AM

Hi Jonathan,

There is no orphan records for the purchase order causing the trouble and the header is present in sourcedocumentheader table. I could not find why the sourcedocumentline returns 0.

Reply