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?
How to study CDS Table Functions
CDS Table Functions has 5 lessons (2 intermediate, 3 advanced) with about 42 minutes of reading in total. Start with the lesson that matches your level, then read the real project scenario and common mistakes in each one before moving on. After the lessons, say the 10 interview questions out loud in your own words, then check yourself against the model answer in each question (shown once you open it). Use the 15 mock questions to check recall.
Mock test questions covered
Try answering each one before you open the mock test; the answer options and scoring are in the Mock Questions tab.
- A report joins four tables and sums amounts per company code. Which modeling choice fits best?
- Which requirement best justifies a CDS table function?
- A table function shows data from two clients in a test system. What is missing?
- A table function returns 50 rows but processes 8 million because the consumer filters by company code afterwards. What is the best fix?
- When defining the AMDP method that implements a CDS table function, what must be consistent between the CDS DDL signature and the AMDP method signature?
- Which limitation distinguishes a CDS table function from a CDS view entity in terms of data manipulation?
- Which ABAP artifact must be implemented to provide the executable logic behind a CDS table function?
- What happens if the result set structure produced by the AMDP method does not match the RETURNS structure declared for the CDS table function?
- Which statement correctly describes the performance characteristic of CDS table functions?
- What is the primary purpose of defining a CDS table function in an SAP RAP/CDS scenario?
- Which language is used to write the body of the AMDP method that implements a CDS table function?
- How should consumers such as a RAP service access a CDS table function?
- In ABAP Cloud, which object may appear in the USING clause of a table function implementation?
- Which scenario is the best justification for choosing a CDS table function over a standard CDS view entity?
- Which elements can be included directly in the DDL source of a CDS table function definition?