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

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. 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

    (0) 
    1. K Jogeswara Rao 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

      (0) 

Leave a Reply