Hello Raghuvarun,
It is standard behavior for an Order to get completed status (TECO) irrespective of whether all the operations reached CNF status or not, in other words irrespective of the Order itself has reached the CNF status or not. Like many ot seems you want to have the control that without the Order getting CNF status the Order should not be able to get TECO status. Put the following code in the include ZXWO1U03 of User-Exit IWO10004. The desired result is achieved. Please note that the code is embedded between an IF for ZM03 Orders. Means this effect will be applied to that Order type only. You can remove Line 03 and 17, if you want this for all Orders. If you want to have it, change the Order type as per your requirement (PM03 etc).
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+0(8) <> 'REL CNF'. MESSAGE: 'Order can not be completed before reaching CNF status' TYPE 'I'. RAISE COMPLETION_REJECTED. ENDIF. ENDIF.
Hope this helps you.
Best of Luck
Jogeswara Rao K