Creating ODATA Service with CDS Views and Consume the same in SAP CPI
let us assume that we have requirement for creating ODATA service for any SAP Standard table VBAK SALES document header- we can achieve this through simple code in SAP HANA Studio with CDS Views. Here is the below step by step procedure.
Install latest version development tools in eclipse other it will not allow to connect SAP application server.
SAP Development Tools for Eclipse 2020-03 – https://tools.hana.ondemand.com/latest
make the connectivity with SAP application system and create ABAP Repository Object
Create new ABAP Repository object and select as Data Definition as below and specify the Package TR, and object name.
select the new template as -default view and finish.
below is the default code is created – now go ahead and specify the view name and data source name.
choose ctrl+space will get the list of all fields in VBAK table as below – as mentioned you can specify any SAP standard table as there are 200+ fields are there in VBAK table – now we need to select as per the business requirement which are the fields require to expose the data through ODATA service.
activate – once it is activated successfully in the backend SAP Application server SAP HANA view is crated this view can not be edited directly in SAP GUI. we can also run and check the data in Eclipse view.
SAP HANA annotation is added with @ODATA.publish.true and activate .
here the below ZCDS_SALESDOCHEADER_CDS ODATA is created. now we need to active and register this into SAP GW.
here the below service is added in GW service maintenance t.code /n/IWFND/MAINT_SERVICE
then go ahead with add the selected service -specify the package name TR for transports.
service metadata is loaded – as above and go and search this service. now the ODATA service is ready for testing.
Now add your Gateway server HTTP service in SAP Cloud connector and consume this ODATA service in SAP CPI time bound iflow with ODATA Adapter and process the data to target legacy cloud applications. For Details you can ref my other SAP Blogs.