Hello guys!
I have difficulty using the CDS / Model-Driven
I would like to know how to lock (not allow editing) some records after they are used in other tables, or after their approval.
In this example, I have two tables "Tema" and "Demanda", I would like that once a "Tema" is used in the "Demanda" table it will no longer be editable. In the same way, in case the "Demanda" is approved (idSituacaoDemanda = 3) it would also not be editable anymore, otherwise the user could edit the record.

I tried to use the rollup, but I found some difficulties and limitations of use - I was unable to apply the condition "IF (Tema.idTema in Demanda.idTema)" - and the calculation update time (the calculation is not instantaneous).
Would there be any outside of applying these elements without the use of rollup, or how to perform the rollup properly?
Thanks!