R3-Edit.: SMQ2: 'Update BDoc status failed - BDoc not found'

Symptom
You are using Mobile Service R/3-Edition.
In the inbound queue in CRM you find Mobile-Service-Bdocs with the
    1. error-message 'Update BDoc status failed - BDoc not found' or
    2. error-message 'Error in Mapping (Details: transaction SMW01) and you find a corresponding Bdoc in transaction SMW01 in State F05 (Information (no processing)) with the error 'Invalid flow context'

Reason and Prerequisites
You have created/changed a service document on your Mobile client. This document is transferred via CRM to R/3. From R/3 then a backanswer will be sent back to CRM and Mobile - but this backanswer cannot be processed, as the original BDoc no more exists.
Due to a missing statement in CRM, the BDoc-Status of the outbound mBDoc in CRM is set to F04 (Confirmed (fully processed by all receivers) - green BDoc), instead of O01 (Sent to receivers (not all have confirmed) - yellow BDoc).
This normally does not lead to any errors. But in case of p.e. a system crash, where the queues could not be processed for several days, it can lead to above error. This happens, if you are reorganizing your BDocs with report SMO6_REORG and thereby the BDocs in state F04 will get deleted.
The Backanswer from R/3 needs the original outbound BDoc in CRM as it has to update this. If it cannot be found anymore, the above error-message is thrown.

Solution
    1. Please implement the attached coding correction.
    2. For every queue-entry, which runs on above error, you have to find out, which service-document should have got updated with the backanswer from R/3.
    If you know the service-document number, the queue-entry can be deleted. Please get back to SAP Development, in case of questions.
    3. As there might be inconsistencies now between R/3 and CDB/Mobile, you should make a request load for the relevant service-document from R/3.