ABAP CDS Table Functions Implemented in AMDP

Page 1

www.selflearningvideos.com ABAP CDS Table Functions Implemented in AMDP In an ABAP CDS Table Function development, we define an entity with the field structure, parameters (optional) and an association to a class/method. With AMDP we’re able to write database procedures directly in the ABAP layer and encapsulate inside the class/method we defined in the Table Function, the call works as the same like any other ABAP methods and we have the following advantages:    

Detailed analysis of runtime errors through ST22; Database procedures debug available through HANA Studio; Transport identical as to ABAP classes. Since AMDP works directly with database scripting some extra steps are necessary like the definition of database and the script language to be used (in SAP HANA the language is the SQL Script). . Scenario

Each airline company provides flight connections to different cities around the world, the user wants to see all the cities supported by a specific airline in a single field separate by comma. Since the number of cities can be different for each one of the airlines we need to generate a logic to concatenate all the cities no matter how many entries are returned. Through a common ABAP CDS View we could use a CONCAT function, but in this case we would need to define a fixed quantity of fields, since the CDS View can’t handle this logic dynamically how should we proceed? In ABAP CDS Table Function, we can implement this with a simple database function called STRING_AGG (String Aggregation). This function is available in the SQL Script but currently there is no support through ABAP CDS View.

Procedure: 1. Create the CDS entity (ZCDSTABLEFUNCTION) by choosing the template ‘Define Table function with parameters’ @EndUserText.label: 'CDS TABLE FUNCTION' define table function ZCDSTABLEFUNCTION returns {


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
ABAP CDS Table Functions Implemented in AMDP by divya.techvideos - Issuu