SAP Knowledge Base Article - Public

2925228 - How to prevent the save of an Opportunity which has errors

Symptom

You notice that you are able to make changes and save an Opportunity though the document has errors.

Environment

SAP Cloud for Customer

Reproducing the Issue

Let's assume you have an Opportunity that has errors

  1. Open the Opportunity XYZ (Where XY is the opportunity ID)
  2. Edit the Opportunity
  3. Make any changes to the opportunity
  4. Save the Opportunity.

You notice that you are able to save the opportunity despite having errors.

Cause

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

Resolution

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:

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

BADI: BADI_OPP_CONSISTENCY_CHECK

Keywords

Opportunity, Error, Save , KBA , LOD-CRM-OPP , Opportunity Management , Problem

Product

SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions