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 :
1-Created an AMDP Class - select fields from tables available in different Client (S4D -320)
2- In table function select the fields from AMDP. Used above annotation (@Clienthandling.type: #Client_Independent) in header section of Table function.
3- join Table function in main cds view where other fields are being pulled from Client(S4D-300).
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.
We can consume data from multiple clients in a CDS view.