This video is a tutorial on handling client dependencies in CDS table functions in SAP. Here’s a summary of the key points:
- CDS Table Function: The presenter explains that when creating a CDS table function, there are two parts: the CDS entity where the function is defined, and the AMDP function implementation where the function is implemented in the AMDP class using SQLScript.
- Client Dependency: The presenter explains that by default, a CDS table function is client-dependent. However, it can be made client-independent using the annotation
@ClientHandling.type
. The presenter explains that theinherited
client handling type is invalid for CDS table functions. - Client-Dependent CDS Table Function: In a client-dependent CDS table function, the first field of the return table must be of type
clnt
. This field is used for implicit client handling and is not part of the final result. The presenter demonstrates this by creating a client-dependent CDS table function and showing that the client field is not included in the final result. - Client-Independent CDS Table Function: In a client-independent CDS table function, the client field is not mandatory and can be omitted. If included, it acts as a normal field in the return table. The presenter demonstrates this by creating a client-independent CDS table function and showing that the client field is included in the final result.
- Performance Considerations: The presenter explains that it is recommended to pass the client field as a parameter in the SQLScript code for performance reasons. This is because the AMDP function runs directly on the database and does not go through the application server. By passing the client field as a parameter, the function only retrieves data from the specified client, which can improve performance.
- Demonstration: The presenter demonstrates how to use client-dependent and client-independent CDS table functions. He shows how to pass the client field as a parameter, how to use the client field in a SELECT statement, and how to display the retrieved data.