ABAP RAP Unmanaged Scenario – how to properly fail a request?

Hello, right now I am doing development for unmanaged scenario app which has to execute some business logic when saving. In my case that would be a function module which will return some error data using a bapiret table.

Using the error table I’m appending every error as a line of the reported-entity table.

After doing that, the OData request does not fail, but returns a positive return code – in my case I get 201 Created on a create request, and the response body is filled with the error messages that were produced from the function module. 

Is it possible to fail the request entirely ( so the request returns error code 500 ) ?

 

Scroll to Top