Post

EML COMMIT ENTITIES — Capturing Validation Responses

Learn how to use COMMIT ENTITIES RESPONSES in ABAP EML to capture failed and reported messages from save-phase validations in RAP.

When using EML to create or update entries, we typically populate all required fields and then use MODIFY ENTITIES followed by COMMIT ENTITIES to persist the data.

However, your RAP BO may have a validation defined at the save phase. These validations are triggered after COMMIT ENTITIES is executed. If the validation fails and returns an error message, simply using COMMIT ENTITIES won’t give you access to those messages.

This is where you need to use COMMIT ENTITIES RESPONSES:

1
2
3
4
5
6
7
8
COMMIT ENTITIES
  RESPONSES
    FAILED   DATA(lt_failed)
    REPORTED DATA(lt_reported).

IF lt_failed IS NOT INITIAL.
  " handle failure
ENDIF.

Example: A validation at the save phase checks whether the ValidTo date is in the past. Without RESPONSES, a failed validation would silently discard the data with no way to capture the error.

For more details and examples, refer to the ABAP EML Cheat Sheet.

COMMIT ENTITIES RESPONSES in EML

This post is licensed under CC BY 4.0 by the author.