Table Function

A Table function is an integral part of CDS evolution which challenges CDS to do more! It is essentially a Code push down mechanism just like a CDS entity. We call Table function a CDS Data Definition Language(DDL) which uses syntax DEFINE TABLE FUNCTION. Some salient features of table functions can be summarized as below:

  • Table function is defined in Core data service Source code
  • It can be consumed by ABAP just like a CDS view
  • CDS table function is implemented with AMDP framework
  • AMDP method which creates the core logic of Table function is written in SQL script
  • AMDP lifecycle management is different than CDS. AMDP can be created using Eclipse ADT just like CDS in AS ABAP(Application Server ABAP) however AMDP creates a corresponding Database Stored Procedure on its first execution(unlike CDS view). Once a corresponding Stored procedure is created, AMDP gets a license to do Code Push Down because of that time onwards, it makes its presence on Database layer. Since AMDP is invoked from CDS, it is mandatory that CDS must be activated first before CDS can be referred to AMDP. Transport must also follow this thumb rule that CDS must be transported before AMDP.
  • Client handling can be done using annotations and there is a good specific way to it. Open SQL does a default client handling for CDS view as well as Table function.

Let’s try to understand Table function with a High-level diagram when Table function is consumed by an ABAP program:

With this diagram, it is clear that Application layer delegates all the workload to Database Layer which is the essential for Code Push Down. With Code Push Down, we always transfer workload to Database layer keeping in mind not to overload Database unnecessarily.


Leave a Reply