Cannot cancel a posted sales invoice

Dear all

I am not able to cancel a posted sales invoice due to the warning “job planning line does not exist” .

I couldn’t figure it out what is the logic of relation between posted document and jobs.

Would anyone advice how to proceed this?

Thank you

Hi @omur_gulcicek,

Can you put here the information from “Copy details”?

Y suspect you have some records in table 1022 “Job Planning Line Invoice” that join some Job Planning Lines with the sales invoice you want to cancel, but, as the error displays, this Job Planning Lines (at least one) do not exist.

If this is the case, you will have to manually delete this orfaned records in table 1022.

Best regards.

Hi @pjllaneras

Thank you very much for your reply.

Here is the details

If requesting support, please provide the following details to help troubleshooting:

Canceling the invoice failed because of the following error:

The Job Planning Line does not exist. Identification fields and values: Job No.=‘JB1000611’,Job Task No.=‘000120’,Line No.=‘20000’.

Internal session ID:
a8a01257-86ba-43f6-a5b4-1e1bf9a5a342

Application Insights session ID:
4a2ce42f-d9b7-43cd-824f-72d42be5e7ab

Client activity id:
b8d4f579-9868-4cf9-a095-5bbc5720ee24

Time stamp on error:
2023-09-14T11:01:16.3526483Z

AL call stack:
“Correct Posted Sales Invoice”(CodeUnit 1303).CreateCreditMemo line 26 - Base Application by Microsoft
“Correct Posted Sales Invoice”(CodeUnit 1303).CancelPostedInvoice line 3 - Base Application by Microsoft
“Cancel PstdSalesInv (Yes/No)”(CodeUnit 1323).CancelInvoice line 12 - Base Application by Microsoft
“Posted Sales Invoice”(Page 132).“CancelInvoice - OnAction”(Trigger) line 4 - Base Application by Microsoft

Sorry but this error is not where the system actually fails, the system fails somewhere else and the error appears on line 26 of the CreateCreditMemo function in “Correct Posted Sales Invoice” codeunit, but it is totally useless to verify what is happening here.

Consider what I said in my previous answer.