Skip to Content
0
Oct 02, 2020 at 08:50 PM

SAP CAP Custom Events Handlers or HANA Triggers?

132 Views Last edit Oct 02, 2020 at 09:01 PM 2 rev

Greetings.

The situation:

I have an SAP CAP project with some entities, to simplify let's say there are only two: E1 and E2. For each one I must also carry three (3) log tables (for now also modeled as CDS entities): create_log_E1, update_log_E1, delete_log_E1, and the corresponding ones for E2.

My doubt: To work with the log tables, what is the best option?

* Option 1: Use custom events handlers. This is for example implementing:

srv.before ('CREATE', 'E1', my_handler_funct (req)); //inside my_handler_funct(..) add the corresponding record in the table create_log_T1

* Option 2: Use database triggers (implemented in .hdbtrigger files) for each log table create_log_E1, update_log_E1, etc.

* Option 3: Another better alternative.

Additional Information:

I am working in the XSA environment on HANA Express Edition installed on my local laptop. Eventually development will take to the Cloud.

Thankful in advance for any help and / or suggestions.