SAP / SAP Mid Level (3 to 8 yrs) Interview questions
How do you expose a CDS View as an OData service?
A consumption-level CDS View annotated with @OData.publish: true (in classical service
generation) or exposed via a service definition and service binding (in the newer RAP-based approach) can be
directly published as an OData service, without hand-writing the service's data-fetching logic separately.
@OData.publish: true define view entity Z_C_CustomerList as select from Z_I_Customer { key CustomerId, CustomerName, Country } " or, in the RAP-based approach: define service Z_CUSTOMER_SRV { expose Z_C_CustomerList as CustomerList; }
Once activated, this automatically generates a working OData service that Fiori apps (or any OData consumer) can call — the service's structure, field names, and basic CRUD behavior are all derived directly from the CDS View's own definition, dramatically reducing the manual service-implementation work compared to older approaches that required separately coding the service's data access logic by hand.
More Related questions...
