SAP CDS FUNC CLIENT INDEP ABEXA



Get Example source ABAP code based on a different SAP table
  



Client-Independent CDS Table Functions
This example demonstrates client-independent CDS table functions.

ABAP_SOURCE_CODE
DEMO CL_DEMO_CDS_FUNCTIONS_NO_CLNT

ABAP_DESCRIPTION
This example class accesses two client-independent CDS table functions.
The CDS table function DEMO_CDS_GET_SCARR_SPFLI_NOCL does not have any elements of the type CLNT.
DDLS DEMO_CDS_GET_SCARR_SPFLI_NOCL
The CDS table function DEMO_CDS_GET_SCARR_SPFLI_CLNT has one element client of the type CLNT.
DDLS DEMO_CDS_GET_SCARR_SPFLI_CLNT
Both CDS table functions have an input parameter clnt of the type CLNT without the annotation @Environment.systemField . The client ID of the current client is passed explicitly to this parameter by the statement SELECT. The implementations in the AMDP method GET_SCARR_SPFLI_FOR_CDS of the associated AMDP classes CL_DEMO_AMDP_FUNCTIONS_NOCL or CL_DEMO_AMDP_FUNCTIONS_CLNT use this input parameter in their WHERE conditions to read the data of the current client only. Both result sets have the same number of rows and are distinguished only by the extra client column of the function DEMO_CDS_GET_SCARR_SPFLI_CLNT.



Latest notes:

In both table functions, the input field for the client ID could also be annotated with the predefined value #CLIENT using the annotation @Environment.systemField to stop the client ID from being passed explicitly by SELECT statements.
NON_V5_HINTS
ABAP_HINT_END