Skip to Content
Author's profile photo K Jogeswara Rao

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.


popup.JPG

(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

Assigned Tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kalyan Chakravarthi
      Kalyan Chakravarthi

      Hi Sir,

      Thanks for sharing, this is commonly Users will ask when we are implementing SAP.

      Best Regards

      Kalyan

      Author's profile photo K Jogeswara Rao
      K Jogeswara Rao
      Blog Post Author

      Exactly Kalyan,

      Thank you for the Review. 🙂

      Best Regards

      Author's profile photo KOTAGIRI Sunil
      KOTAGIRI Sunil

      Hi Sir,

      Already we have implemented the same to one of our client.

      Thanks & Regards,

      Sunil Kotagiri

      Author's profile photo K Jogeswara Rao
      K Jogeswara Rao
      Blog Post Author

      Good to know that, Srinika !

      Thank you

      Author's profile photo Former Member
      Former Member

      Excellent! many thanks!

       

      Author's profile photo Former Member
      Former Member

      thank you so much sir for this post and share knowledge.

      Author's profile photo K Jogeswara Rao
      K Jogeswara Rao
      Blog Post Author

      Pleasure is all mine as always Hitendra. Thank you for the review 🙂

      Author's profile photo Imran Shaik Mohammed
      Imran Shaik Mohammed

      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

      Author's profile photo K Jogeswara Rao
      K Jogeswara Rao
      Blog Post Author

      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

      Author's profile photo Vijay kumar
      Vijay kumar

      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.

       

      Author's profile photo K Jogeswara Rao
      K Jogeswara Rao
      Blog Post Author

      Use this code in include ZXQQMU20  (user-exit QQMA0014).

      IF i_viqmel-qmart = 'Z1' AND i_viqmel-phase = '1'.
      
        DATA: it_stat TYPE TABLE OF jstat,
              wa_stat TYPE jstat.
      
        e_viqmel-phase = '3'.
      
        wa_stat-stat =  'I0068'.
        wa_stat-inact = 'X'.
        APPEND wa_stat TO it_stat.
      
        wa_stat-stat =  'I0070'.
        wa_stat-inact = ' '.
        APPEND wa_stat TO it_stat.
      
        CALL FUNCTION 'STATUS_CHANGE_INTERN'
          EXPORTING
            objnr  = i_viqmel-objnr
          TABLES
            status = it_stat.
      
      ENDIF.

      Good luck

      Author's profile photo Abhishek Singh
      Abhishek Singh

      Excellent ....!!!

       

      Nice Document .....!!!

       

      Thanks a lot Sir for sharing your idea and knowledge...!!!