SAP Knowledge Base Article - Public

3699524 - How to block service order release when validation fails

Symptom

There's a requirement for the system to block the release of a Service Order when validation fails.

By using the BAdI CRMS4_SERV_CHECK_BEFORE_SAVE, custom validations were implemented to check if the service order should be released according to business rules, an error message was implemented in the BAdI.

The requirement is for the system to abort the save/release process and display an error message or log visible to the end user. However, this is not the current behavior: the system allows saving, releases the service order and the error can be seen in the error log.

Environment

SAP S/4HANA Cloud Public Edition

Cause

This is the correct system behavior. The message type 'E' (Error) adds an error message to the message log. The transaction is not aborted and all the savings are done correctly, this is necessary because if the transaction is not saved, then the message wouldn't be added to the error log.

Resolution

Use the message type 'E' (Error) to add an error message to the message log.

  • This ensures that the transaction is not aborted and all the savings are done correctly.
  • The error message will be appended to the error log.
  • Although the service order is released, the process cannot continue until the error is resolved.

Note: avoid using message type 'A' (Abort) as it terminates the program execution abruptly, preventing the error message from being saved in the error log. SAP strongly advises against using message type 'A' due to potential inconsistencies and unwanted errors.

Keywords

service order release, validation fails, error message, message type E, message type A, save abort, error log, service order management, BAdI CRMS4_SERV_CHECK_BEFORE_SAVE, validation error , KBA , CRM-S4-SRV-SVO-2CL , S4CRM: Service Order (Public Cloud) , How To

Product

SAP S/4HANA Cloud Public Edition all versions