Damage Code & Cause Code Mandatory before Technical Completion(TECO)
Damage Code and Cause Code Mandatory in Notification before doing Technical Completion (TECO)
Often there is a requirement to populate Damage Code and Cause Code to meet Reporting Requirements. In standard SAP, there is no such functionality to hard stop Technical Completion of order if the Notification Damage Codes and Cause Codes were not maintained.
To achieve this, use Exit IWO10004. This Exit can be used for making damage and cause code mandatory in notification while TECO ’ing order.
Reason to implement: – Damage and Cause codes are useful in order to identify the root cause of the breakdown. These codes are inputs to the sap standard report MCI5 (or) IW69. So in order to identify these we need to maintain them mandatory while doing TECO. Users usually by pass these fields in Notifications not knowing the importance of them.
Risks Involved while implementing: – Firstly we tried through configuration settings in OIAL to set these fields mandatory in notification level through screen elements. But users identified that they can’t be able to figure out the actual damage and causes unless they complete the order. So, approached to the exit while Technical Completion of order.
Create a project using transaction CMOD.
Give a short text for the project, save and select Enhancement Assignment.
Here assign our identified Exit IWO10004, save and select Components.
Double click on the Function exit EXIT_SAPCOIH_004.
Double click on INCLUDE ZXWO1U03.
Paste the following code in Include
Exit Used: – IWO10004 (Maintenance order: Customer check for order completion)
Function Module: – EXIT_SAPLCOIH_004
Project: – ZI_IW32T
data : v_fecod type viqmfe-fecod, "VIQMFE (PM Notification - Item)" v_urcod type viqmur-urcod. "VIQMUR (PM Notification - Item Cause)" check caufvd_imp-auart eq 'PM01'. "Order Type PM01" if sy-subrc = 0. select single fecod from viqmfe into v_fecod "(FECOD = Damage Code)" where qmnum = caufvd_imp-qmnum. select single urcod from viqmur into v_urcod "(URCOD = Cause Code)" where qmnum = caufvd_imp-qmnum. if v_fecod is initial and v_urcod is initial. message id 'IM' type 'E' number 752 with 'Kindly fill up the damage code and Cause code..!'. exit. elseif v_fecod is initial and v_urcod is not initial. message id 'IM' type 'E' number 752 with 'Kindly fill up the damage code..!'. exit. elseif v_fecod is not initial and v_urcod is initial. message id 'IM' type 'E' number 752 with 'Kindly fill up the Cause code..!'. exit. endif. endif.
Save, check and activate.
Take help of your Abaper to implement this logic.
Above logic does the following to the work order while doing Technical completion(TECO)
If cause code is missing under notification-items
If Damage code is missing under notification-items
If Cause Code and Damage code were empty under notification-items, systems throws following error
Hope this blog helps to meet lot of business requirements…!!!
Feel free to comment and advice any improvements and suggestions.
Great work hari, so well explained, easy to understand
I appreciate the functionality but I have to be honest the code is pretty poor.
Having an exit statement after an error message? That is completely redundant.
check caufvd_imp-auart eq 'PM01'. "Order Type PM01"
if sy-subrc = 0.
Is bad for 2 reasons:
The if statement is redundant after a check statement.
Also using a check statement in a user exit is bad practice in most instances - if someone adds in code after yours and the process fails your check statement their code will not be executed. In user exits with large blocks of code this is hard to find.
The correct statement is:
if caufvd_imp-auart eq 'PM01'.
"some code here
Then your code gets executed under the right conditions while it does not interfere with the code of others.