RAP_CDS_ODATAadvanced
CDS Table Functions
Understand CDS table functions for scenarios that require database-side logic beyond standard CDS expressions. Learn AMDP-backed implementation, parameter handling, result contracts, performance trade-offs and when a table function is justified instead of Open SQL or a normal CDS view.
Overview
Understand CDS table functions for scenarios that require database-side logic beyond standard CDS expressions. Learn AMDP-backed implementation, parameter handling, result contracts, performance trade-offs and when a table function is justified instead of Open SQL or a normal CDS view.
Lessons in this topic
- CDS Table Functions Part 1: When You Really Need a Table FunctionDecide when a CDS table function is really needed: what it is, what normal CDS view entities can already do, and the typical cases (complex SQLScript logic, ranking, iterative calculations) where a table function is justified.
- CDS Table Functions Part 2: Building a Table Function with an AMDP ImplementationBuild a CDS table function end to end: the CDS definition with parameters and return structure, the AMDP class with FOR TABLE FUNCTION, the SQLScript implementation, activation and a first test in data preview.
- CDS Table Functions Part 3: Parameters, Client Handling and Session ContextHandle runtime inputs in table functions correctly: parameters with system defaults, client handling with @ClientHandling and SESSION_CONTEXT, language and date from the session, and passing parameters through wrapping views.
- CDS Table Functions Part 4: Performance with HANA Plan AnalysisMake table functions fast: why consumer filters may not be pushed down, how to design parameters and set-based SQLScript, how to measure with ST05, SQL trace and HANA PlanViz / explain plan, and how to compare against a CDS alternative.
- CDS Table Functions Part 5: Testing, Clean Core and AlternativesKeep table functions maintainable: test them with ABAP Unit and test doubles, protect them with access control on the wrapping view, respect ABAP Cloud rules for AMDP, and know the modern alternatives in CDS.
Interview questions covered
- When would you use a CDS table function instead of a CDS view entity?
- A table function fails to activate with "result structure does not match". What do you check?
- What is a CDS table function and how is it built?
- Walk through building a "top 3 oldest open requests per supplier" feature with a table function.
- A supplier dashboard based on a table function shows each supplier twice in a test system. What is the likely cause?
- What trade-offs do you consider before approving a CDS table function?
- You inherit several CDS table functions. What do you review?
- How do parameters and session defaults work in CDS table functions?
- A table function behind a dashboard takes five seconds. How do you improve it?
- How do you test and secure a CDS table function?