SAP CDS FUNC CLIENT DEP ABEXA Get Example source ABAP code based on a different SAP table
SAP Help
Client-Dependent CDS Table Functions This example demonstrates client-dependent CDS table functions.
ABAP_SOURCE_CODE DEMO CL_DEMO_CDS_FUNCTIONS_CLIENT
ABAP_DESCRIPTION This example class accesses two
client-dependent> CDS table functions>. The CDS table function DEMO_CDS_GET_SCARR_SPFLI> does not have any input parameters of the type CLNT>. The implementation in the AMDP method GET_SCARR_SPFLI_FOR_CDS> of the associated AMDP class CL_DEMO_AMDP_FUNCTIONS>> reads the data of all clients. Only the current client is selected here in SELECT>> statements. DDLS DEMO_CDS_GET_SCARR_SPFLI The CDS table function DEMO_CDS_GET_SCARR_SPFLI_INPCL> has one input parameter CLNT> of the type CLNT>. The annotation @Environment.systemField>> is assigned to this parameter with the predefined value #CLIENT>>. The client ID of the current client is passed to this parameter implicitly in SELECT>>. The implementation in the AMDP method GET_SCARR_SPFLI_FOR_CDS> of the associated AMDP class CL_DEMO_AMDP_FUNCTIONS_INPCL>> uses the input parameter to restrict the result set to the current client. DDLS DEMO_CDS_GET_SCARR_SPFLI_INPCL The result of the accesses performed without the addition CLIENT SPECIFIED> is the same for both CDS table functions. If the obsolete addition CLIENT SPECIFIED>> were used to access the CDS table function without an input parameter for the client, the result set would have an extra client column and the current client must be selected explicitly in the WHERE> condition. The obsolete addition CLIENT SPECIFIED >> should not be used and is shown as comments here. It cannot be specified for the CDS table function with an input parameter for the client anyhow.