Remove hard coded calculations from CDS-views
Im trying to remove some calculations from the CDS Views. I want to be able to edit those calculations with parameters through BRF+ or HRF. It should consume CDS-Views and do some caluculations based on them. The results should then be consumable by another View.
The workflow should then be something like this:
Is this possible with BRF+/HRF? If so, are there any examples?
Christian Lechner replied
hard question at least no yes/no answer possible
I guess when you talk about CDS views you mean ABAP CDS Views. This means that the views are managed by ABAP (i. e. the lifecycle), so I would stick to the ABAP world for your requirements and not go to HRF as the artifacts there are linked to the HANA lifecylce management and you have to deal with issues keeping the stuff synchronized. Anyway to the best of my knowledge the HRF is not really tightly integrated into the ABAP world and this might be a real issue if you want to adress them from ABAP (native SQL for sure is always possible, but I would not recommend that).
So sticking to BRFplus there is the DB lookup exprression that allows you to model SQL statements in BRFplus. But there are some limitations e. g. you cannot call a CDS View with parameters. I do not know if they will be removed some day, so you cannot directly interact with CDS views with(!) parameters from BRFplus. So I see two options in order to get more flexibility in your scenario:
You can call the first CDS view(s) from ABAP getting some result set. Thena ou call a BRFplus function that takes this result set and determines the parameters for the consequent call of CDS views with parameters. So the result data object of the function call returns the parameters back to the ABAP and you can call the second CDS view with those parameters.
You encapsulate the CDS view calls in class methods that can be called by BRFplus via the procedure expression. You would then somewhere in your ABAP program call a BRFplus function. This function internally calls the encapsulated CDS views via a procedure call expression. As in option 1 the first call would return the input for the BRFplus and then you can determine the input parameters for the second procedure call in BRFplus.
Any combination of these options is for sure also feasible. It really depends on the concrete scenario and where you want to put more flexibility/agility into your prgram flow by BRFplus
Hope that gives you some hints and ideas how to deal with the situation you described.