cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to handle errors for semantic key with number range in RAP?

fabianlupa
Contributor
0 Kudos
308

Following scenario:

Managed RAP BO wit draft with managed numbering and UUID as key. In addition a semantic key should be generated by the system as a non-key field using a number range object. How do you do this correctly?

I tried using a determination on save and using number_get_next there. That works usually, but:

  • In case of errors you can only report a warning in a determination using reported as there is no failed which the user can chose to ignore. According to the documentation (https://help.sap.com/docs/abap-cloud/abap-rap/determination-and-validation-modelling#failed-entries-...) you should store the error somewhere in a buffer and check for it in a validation.
  • While that does work, in case of an error the save is blocked but also the number from the number range has still been picked since the LUW used in the determination is not rolled back? This results in a number gap.

I had a look at late unmanaged numbering but that only seems to be usable for the key field which in my case should still be managed numbering with UUID.

Is this scenario not covered or am I missing something?

View Entire Topic
umasaral
Contributor
0 Kudos

In the context of the ABAP RESTful Application Programming (RAP) model, late determination refers to the execution of determinations during the save sequence, specifically at the end of a transaction when changes from the transactional buffer are  persisted to the database. This approach ensures that certain business logic or validations are applied just before the data
is saved, maintaining data integrity and consistency.

Key Aspects of Late Determination:

Timing: Late determinations are executed during the save sequence, after all modifications have been made but before the data is committed to the database.

Trigger Conditions: These determinations can be triggered by specific operations such as create, update, or delete, or by changes to particular fields.

Implementation: In the RAP handler method FOR DETERMINE within the local ABAP behavior pool, the business logic for the determination is implemented.

Benefits of Late Determination:

Data Consistency: Ensures that all necessary validations and business rules are applied just before data persistence, maintaining the integrity of the data.

Performance Optimization: By executing determinations at the end of the transaction, unnecessary computations during intermediate stages are avoided, potentially improving performance.

For more detailed information, you can refer to the following resources:

[RAP determination | ABAP Keyword Documentation] (https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/enUS/ABENBDL_DETERMINATIONS.html)

[ABAP RESTful Application Programming [24] – External Numbering and Managed Early Numbering – Discovering ABAP](https://discoveringabap.com/2023/03/02/abaprestfulapplicationprogramming24externalnumberingandmanage...)

These resources provide comprehensive insights into the implementation and advantages of late determinations within the RAP model.

Note:

https://community.sap.com/t5/technology-blogs-by-sap/determinations-in-abap-restful-programming-mode...

https://discoveringabap.com/2023/03/02/abap-restful-application-programming-24-external-numbering-an...

https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/ABENBDL_DETERMINATIONS.html

fabianlupa
Contributor
0 Kudos
Most of your links do not work and your answer looks AI generated to be honest. I still don't see how a "late" determination would be classified as such instead of a normal determination.