You notice that you are able to make changes and save an Opportunity though the document has errors.
SAP Cloud for Customer
Reproducing the Issue
Let's assume you have an Opportunity that has errors
- Open the Opportunity XYZ (Where XY is the opportunity ID)
- Edit the Opportunity
- Make any changes to the opportunity
- Save the Opportunity.
You notice that you are able to save the opportunity despite having errors.
As per the current system design, Opportunity is an Error Tolerant Document and therefore it is allowed to Save the document despite the error message. However, the system will always pop up the error whenever you open the document in order to alert you
You have two approaches to change the standard behavior
- A PDI customization
- A KUT validation rule
The later would be the simple approach but it has some limitations.
The rule has to be created by checking the consistency status code field of the opportunity. If the Consistency status code has a Value "02-Inconsistent", it means that the opportunity has errors. By validating the status of the field, you can raise your own error along with the standard errors which will prevent the save of the document.
Example Case: You want to prevent a save, if the Contact Partner has Status "Not Active".
The KUT validation based on consistency status covers most error situations. However it has the following restrictions:
- Not all party validations are called for each and every roundtrip (change). This is in favor of performance because of many party validations. The complete party validations are called only at the Event On_Finalize (Save). Therefore the consistency status might not yet have its final value. This is the reason why the error with contact party is not raised with change certain fields.
- PDI errors are also not considered by the consistency status in the standard.
Considering the above restrictions, the solution proposal is to implement a PDI validation at Finalize(Save) to check the consistency status (after setting of the final consistency status). Additionally, if the consistency status shall cover the PDI validations (errors), the following BADI needs to be implemented to catch the errors from PDI:
Opportunity, Error, Save , KBA , LOD-CRM-OPP , Opportunity Management , Problem