Stop Confirming TECOed PM Order: User-Exit Way
Years ago, while SAP-PM implementation, one of the several questions about Standard SAP process is this too. i.,e., Why system allows Operation Confirmations after Order was Technically Completed?. Answers were known to such questions as time passed on. But, we needed to satisfy our requirements, For this like many others we too had to do something in Customization or Enhancements.
Here I want to mention few words about the advantage and significance of User-Exits. In situations like above, where the solutions were always not available in Customization, then a simple few line codes in User-exits always made impossibles, possible. Out of several such cases I remember one here discussed recently:. Many times, we treat the Enhancements to be the objects of someone-else’s jurisdiction. The way Customization is a part of Development, Workbench is also a part of Development, where a functional person need to know a small, very small coding to reap big benefits out of User-Exits. In my view for a Functional person conversant with this, Enhancements will be more confident, comfortable and effective way of finding solutions. Often only simple few line codes need to be written, the way we give codes in Objects like the Dependencies (CU01), Codes in Infoset Extras etc. In case one is unable to, no problem, it is a tiny task for your ABAPer.
Objective of this post
To share my knowledge about the ‘User-Exit way of Preventing Confirmations in TECO’d Orders‘.
Finding proper User-Exit for our issue is the main thing. This can be easily done by searching queries in SCN etc. In the present case more than one Transactions involved i.e., IW41, IW42 and IW44 the confirmation Tcodes. We are going to use 2 User Exits, as shown below.
1. To prevent user from Confirming the Operation using Tcode ‘IW41’.
User-Exit is CONF0001 ( Include ZXCOCU01 ). Just put the following code in this include.
DATA: V_LINE TYPE J_STEXT. CALL FUNCTION 'STATUS_TEXT_EDIT' EXPORTING FLG_USER_STAT = 'X' OBJNR = I_CAUFVD-OBJNR ONLY_ACTIVE = 'X' SPRAS = SY-LANGU IMPORTING LINE = V_LINE EXCEPTIONS OBJECT_NOT_FOUND = 01. IF V_LINE+0(4) = 'TECO'. MESSAGE: ' Confirmation not possible as the Order has already been Completed.' TYPE 'E'. ENDIF.
Now, when user tries to confirm operation of a TECOed order through Tcode IW41, he will get the error shown in this picture IW41 error
2. To prevent user from Confirming the Operation/s using Tcodes ‘IW42’ and ‘IW44’.
User-Exit is CONFPM02 ( Include ZXCOFU02 ). Put the following code in this include.
DATA: V_LINE TYPE J_STEXT. CALL FUNCTION 'STATUS_TEXT_EDIT' EXPORTING FLG_USER_STAT = 'X' OBJNR = CAUFVD_IMP-OBJNR ONLY_ACTIVE = 'X' SPRAS = SY-LANGU IMPORTING LINE = V_LINE EXCEPTIONS OBJECT_NOT_FOUND = 01. IF V_LINE+0(4) = 'TECO'. MESSAGE: ' Confirmation not possible as the Order has already been Completed.' TYPE 'E' . ENDIF.
Now, when user tries to confirm operation/s of a TECOed order through Tcode IW44, he gets the error shown in the this picture IW44 error
Hope this post too helps many.
Jogeswara Rao K