In this blog post, we will demonstrate how to import external edmx files into CDS model and expose the entities defined in the edmx file as projections.
Importing EDMX Files into the CDS Model
Suppose you have downloaded API_BUSINESS_PARTNER.edmx file from https://api.sap.com/api/API_BUSINESS_PARTNER/overview, and you would like to use it as an external file in your CAP project. First open your cds service model srv/cat-service.cds using the CDS Graphcal Modeler:
Now drag the edmx file from the file explorer into the CDS Graphical Modeler, and you will see below import dialog:
Click OK button to dismiss the dialog. Now you will be able to see the imported namespace from the edmx file in the graphical modeler:
We can now create a projection for the entities defined in the edmx file:
References
https://blogs.sap.com/2020/05/26/cap-consume-external-service-part-1/
Summary
In this blog post, we demonstrate how to import an external edmx file downloaded from https://api.sap.com and import it to the CDS model in your CAP project through the CDS Graphical Modeler, and we also demonstrate how to create a projection for a entity defined in the external edmx file after the file is imported.