ABAP CDS View Client Handing: Consuming data from different clients in ABAP CDS view

There are very few articles available on how to consume data from multiple clients in a CDS view, as an SAP EA consultant this encouraged me to write this article based on the experience we got in one of our previous assignments.

Version: SAP S/4 HANA 1909 and above

Abstract : ABAP CDS views are main development artifact of S/4 HANA Embedded Analytics. CDS views are built on top of Standard database tables. Standard CDS views can also be used as a data source in cds views. These CDS views are then consumed in different reporting tools (SAP FIORI, POWER- BI, SAP SAC..etc) for different reporting requirements.

Introduction :  In many real world projects the tables from different sources are stored on multiple clients. For example FICO,TM,MM,PTP standard tables are stored on one Client (eg. 300) and YL(Yard Logistics ) is stored on another client (eg. 320).

For reporting purpose we might have to build CDS views that consumes data from TM, and YL simultaneously!!

Records from tables stored on Multiple clients can be selected in a CDS view using AMDP Class and Table function. SAP has provided an annotation for client handling :

(@Clienthandling.type: #Client_Independent)

Steps :

1-Created an AMDP Class – select fields from tables available in different Client (S4D -320)

AMDP%20Class

AMDP Class

2- In table function select the fields from AMDP.  Used above annotation   (@Clienthandling.type: #Client_Independent) in header section of Table function.

Table%20Function

Table Function

3- join Table function in main cds view where other fields are being pulled from Client(S4D-300).

JoinTableFuction

JoinTableFuction

now fields from separate client are available in the same cds view where we are working with other fields from tables present on current client.

Conclusion – 

  • We can consume data from multiple clients in a CDS view.

References : – https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abencds_client_handling.htm

Your feedback/thoughts are appreciated and would be encouraging for further articles.  🙂