cancel
Showing results for 
Search instead for 
Did you mean: 

Managed RAP and errors (FAILED) from a determination.

rikardtlouw
Explorer
0 Kudos

Hi, I am trying to determine what best practice is in managed RAP for error handling for determinations and validations. 

If I have a determination with the possibility of raising and error (Let's say it has to determine a specific value in my model from an API call on create) . This API call could fail, and I could add a message to the REPORTED structure but as there is no FAILED structure in a determination, I cannot flag it as a failure which I might want to do.

I don't want to duplicate the code in a validation and do a second API call just to check. What would be a clean way to handle this scenario in a managed solution?   

Accepted Solutions (0)

Answers (1)

Answers (1)

SachinArtani
Participant
0 Kudos

Hi,
I could think of a workaround that when the API fails, you capture the failed message in a static variable that you would define in the implementation class, and in validation, check the value in static variable and fail the operation.
Thanks,
Sachin

rikardtlouw
Explorer
0 Kudos
Its basically what I ended up doing. I added the cl_abap_behavior_saver_failed for the save_modified and added a singleton class that allows me to buffer errors not related to a Validation and then raise them in there. Works well but don't think it's a pretty solution 🙂
SachinArtani
Participant
0 Kudos
If it's a custom solution and not an extension to standard BO and with Strict (2) you are able to do everything, then I guess there's nothing more prettier than what you have done. 🙂