During the implementation of SAP-PM years ago, one of the several questions arose in our minds was ‘Why SAP allows Technical Completion, before all Operations attain a CNF status, as whole the Order itself attains a CNF status?’. We began to understand later that this flexibility might have been provided to facilitate several other business requirements. At the same time SAP has provided Enhancements to customize specific business needs of the end-user.
The present subject is a kind of very frequently asked requirement. So it is though a documented reference would be better serving the forum members.
Here it is about how we achieve it.
The user-exit we use for this purpose is:IWO10004 - Maintenance order: Customer check for order completion.
Put the following lines in the include ZXWO1U03 (of Function Exit EXIT_SAPLCOIH_004)
DATA: V_LINE TYPE J_STEXT. IF CAUFVD_IMP-AUART = 'ZM03'. CALL FUNCTION 'STATUS_TEXT_EDIT' EXPORTING FLG_USER_STAT = 'X' OBJNR = CAUFVD_IMP-OBJNR ONLY_ACTIVE = 'X' SPRAS = SY-LANGU IMPORTING LINE = V_LINE. IF V_LINE+5(3) <> 'CNF'. MESSAGE: 'Order can not be completed before reaching CNF status' TYPE 'I'. RAISE COMPLETION_REJECTED. ENDIF. ENDIF.
The screen-shot of the include after implementing the code.
With this code in the include, whenever user tries to Technically Complete an Order before one or many operations are not confirmed, in other words before the Order itself reaches the CNF status, he will be getting this pop-up.
(You may customize the above message as per your requirement in the line no.14 of the code)
No further activity is seen.
Once the Order reached the CNF status, it will be ready for TECO, the user-exit code does not come in the way.
Note:
Observe Line 3 of the code, this line confines this restriction to one Order type i.e., ZM03. In case of generalized use remove the Code lines 3 and 17.
In case of specific Order type usage then replace ZOM03 by your Order type.
Hope members will be benefited by this blog too.
Thank you
Jogeswara Rao K