Document posted in Process Director with SAP document number, but SAP document does not exist in SAP

Document posted in Process Director with SAP document number, but SAP document does not exist in SAP

Question / Problem: 

This issue happens sporadically, is usually isolated to one or two documents, and to date, we have not been able to recreate the scenario.   We have also seen the issue occur when posting documents through Repetitor where the documents with the issue are not consecutive.  So far, we have not seen any related dump in /ST22, no evidence of an issue in any application server logs or in /SM13, and no way to determine what error condition occurred in SAP to prevent the document from being created.

Answer / Solution: 

As of this writing, there is no solution available.  This issue is due to a failed update task on the SAP side. Essentially, a connection is established with SAP that allows the PD document to post, but the SAP system fails when creating the associated SAP document. In many cases, application server logs can be used to determine the root cause.

SAP document creation is triggered "In Update task.” This means, when we trigger the BAPI call to create the SAP document, SAP will first perform all validations.  If no issue is found, SAP will allocate a number from the number range and return a success message. This sounds like the sap document has been already created, but this is not what really happens.

SAP allocates the number from the number range, but the actual SAP document creation is queued and executed in the Update task. If there is a problem with SAP, the UPDATE task will fail, and SAP document creation will be aborted (even though the number has been allocated and already provided to PD).

PD is not aware of the fact that the Update task fails (as it already has a success message), and the document in PD remains in "Posted" status with reference to an SAP document that was never created.

There is a report (/cockpit/post_crash_status_upd (/se38)) that was first available with PD AP 7.6 that will find documents with failed update tasks. It allows you to select a Client ID, a Company Code range, a document number, a Document Date range, and/or a User range.  This report presents a list of documents and allows you to update the document(s).  If you click the button to "Update PD  AP doc's," this will remove the link to the SAP invoice that does not exist and set the PD AP document to error status so you can then re-process the document.