Title: @(Path :’/ Browse ‘) in SAP Cloud Application Programming

Service implementation of.cds file source code:

using { sap.capire.bookshop as my } from '.. /db/schema'; service CatalogService @(path:'/browse') { @readonly entity Books as SELECT from my.Books { *, author.name as author } excluding { createdBy, modifiedBy }; @readonly entity ListOfBooks as SELECT from Books excluding { descr };

This @(path:’/browse’) is equivalent to the @Path annotation in Spring.

  • As SELECT from my.Books: Like SAP ABAP CDS view syntax, specify the primary data source of the Entity.
  • My is an alias. The full database table is called sAP.CAPIRE.BOOKSHOP, and the table name is associated with the alias through the USING keyword.

  • author.name as author: The syntax is similar to that of SAP ABAP CDS view, in that since the author is an association in the Books entity, we use.name to access the association target entity and the name field of the author.
  • Remarked in {createdBy, modifiedBy} : The fields exposed to Odata do not include the createdBy and modifiedBy fields.
  • @readonly entity ListOfBooks as SELECT from Books exclusive {descr}

The final result:

http://localhost:4004/browse/…

http://localhost:4004/browse/…

More of Jerry’s original articles can be found on “Wang Zixi “: