I would like to call a method from a class in an existing CDS view to get certain data, which can only be called by this method. So I want to call a method from a CDS View.
What is the easiest way to do this?
I would be very happy about an example with code.
NOTE: Your abap logic will only be executed when the CDS view is consumed by something that handles annotations i.e. exposed as an Odata service, but not in transaction SE16N or the preview in Eclipse. There two ways actually. First option:
Your abap class:
View in eclipse: View in odata:
Second option:
The second way is to change your service's DPC class with your custom class, which inherits this standard class and do your custom logic in those redefined methods. Personally, I would go with the second option. I haven't tried it but I have a feeling that performance would be better. :)
For more info please check: https://blogs.sap.com/2020/05/11/abap-code-exits-in-cds-views/