Prevent TECO of PM Order before CNF status (User Exit IWO10004)
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)
IF caufvd_imp-auart = 'ZM03'.
DATA:i_stat LIKE jstat OCCURS 0 WITH HEADER LINE,
l_objnr TYPE j_objnr,
v_cnf(1).
SELECT SINGLE objnr FROM aufk INTO l_objnr WHERE aufnr = caufvd_imp-aufnr.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = l_objnr
only_active = 'X'
TABLES
status = i_stat.
LOOP AT i_stat.
IF i_stat-stat = 'I0009'.
v_cnf = 'X'.
ENDIF.
ENDLOOP.
IF v_cnf <> 'X'.
MESSAGE: 'Order can not be completed before reaching CNF status' TYPE 'I'.
RAISE completion_rejected.
ENDIF.
ENDIF.
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.18 of the code)
So TECOing of non-CNF order is stopped. Once the Order attains the CNF status, it will be ready for TECO, the user-exit code allows it for TECO.
Note:
Observe Line1 of the code, this line confines this restriction to one Order type i.e., ZM03. In case of generalized use remove the Code lines 1 and 21.
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
KJogeswaraRao
Hi Sir,
Thanks for sharing, this is commonly Users will ask when we are implementing SAP.
Best Regards
Kalyan
Exactly Kalyan,
Thank you for the Review. 🙂
Best Regards
Hi Sir,
Already we have implemented the same to one of our client.
Thanks & Regards,
Sunil Kotagiri
Good to know that, Srinika !
Thank you
Excellent! many thanks!
thank you so much sir for this post and share knowledge.
Pleasure is all mine as always Hitendra. Thank you for the review 🙂
Hi,
Thanks for the solution.
But i have a clarification.
Why cant we use system status PCNF settings to restrict the TECO using tcode BS22?
Actually, we have achieved this restriction of the TECO by modifying the system status setting for PCNF.
Please advice.
Regards
Irman
You can do that.
Please go through my just replied post at the bottom of this discussion.
Components Requirement Quantity in orders !!
There are two reasons to prefer enhancements like this:
These are very flexible, purview can be extended to wide area like explained in above post. Secondly altering BS22 is discouraged by many.
Risks / Consequences Associated with making changes in BS22
Risks/Consequences Associated with changing short text in BS22
Please treat this post as another available alternative for the task.
Regards
KJogeswaraRao
IW22 Automation of PUT IN PROCESS - Notification Status
Hi,
My requirement is to Automate the Status Notification in IW22 Transaction without clicking the Put in Process Flag.
If the Notification type - Z1 and Notification status is OSNO
without clicking the FLAG:
Need to automate - Notification type - Z1 and Notification status is NOPR.
Use this code in include ZXQQMU20Â Â (user-exit QQMA0014).
Good luck
Excellent ....!!!
Nice Document .....!!!
Thanks a lot Sir for sharing your idea and knowledge...!!!