This will help you on your way forward:
In the SAP standard business model, if the user technically completes the works order, the following consequences occur:
1. Any reservations for which goods issues have physically been completed, but which have not applied in the SAP system, are deleted. There is then no way of recording the consumption of spares against the appropriate works order.
2. Any purchase requisitions that have not been converted into purchase orders are deleted.
The system does not provide any warning that these deletions have taken place. Furthermore, since the system permits simultaneous completion of multiple works orders (via IW38) there is a tendency to blindly close these works orders without adequate reviewing.
Because of these issues, I suggest the following method:
Block technical completion where there is any work planned and this has not been progressed to a point of final confirmation completeness; this process can be further enhanced by checking that key details on the related Breakdown/Unplanned Notification are complete.
This can be achieved by user exit "exit_saplcoih_004" when trying to do the TECO via IW38, which broadly proceeds as follows.
1. Evaluate the works order plan against actual confirmations, and determine if the activity is complete in quantity or by explicit completed flag.
2. Check the required fields on the breakdown/unplanned or call-out/after hours notification.
3. Confirm that no part of the tests in 1 and 2 failed. Where the works order and notification have failed, a report can then be generated explicitly defining all activity and information that must be completed in order to achieve technical completion.
4. If the user is allowed to override this block block, and elects to do so, then the order is closed according to the SAP standard method. This method clears open reservations and any purchase requisitions which have not been converted to purchase orders. I suggest a separate authorisation for the override so that you can still achieve control via segregation of duties.
The following Business rules need to be met for successful technical completion and should to be coded into the user-exit via your ABAP developers:
For the Works order:
- Internal operations: All final confirmations are required, or, if the operation is not to be completed then it is to be deleted.
- External operations and spares procurement: All purchase requisitions must be turned into purchase orders, which must be goods receipted. Alternatively, if the external spare or item of labour is no longer required then the PR, together with any follow on PO must be deleted.
- Internal spares: All reservations must either have the final goods issue completed or those items not required for the completion of the works order must be deleted.
For the Notification:
- Only applies to breakdown/unplanned and call-out/after hours notifications.
- Check that each of these fields is complete: the Breakdown flag, malfunction start and end date and time. For related Catalogs details for the Notification (if you are using them):
- For notification item number 0010: Check that the following fields have been completed: object part, failure code or text.
- For each of the notification causes: Check for a cause that is not deleted. Check that the code or text field is complete.
- For each of the notification activities. Check that each activity is complete.
To help your developers, the following tables will need to be accessed while processing the user-exit:
AFKO PP order header
T430 Operation/Activity control key
AFKO PP order header
AFVC Operation within an order
AFRU Operation confirmations
VIAUFKS PM Order Selection View
MSEG Document Segment: Material
AFVV Operation times.
AUFM Material movements for order.
EBAN Requisition items
EBKN Requisition items Account Assi
EKPO Purchase order
EKBE Purchase order history
EKKN Purchase order Account assign
JEST Object status
QMMA Quality notification activities
QMEL Quality notification
QMFE Quality notification items
QMUR Quality notification causes
QMIH Quality message maintenance data excerpt
IFLOT Functional Location
EQKT Equipment short texts