SAP / SAP Mid Level (3 to 8 yrs) Interview questions
What is metadata in an OData service and why does it matter?
The $metadata document is an OData service's self-describing schema — an XML document
listing every entity type, its fields (with data types), relationships between entities, and supported
operations. Any OData-aware client (Fiori Elements apps in particular) reads this metadata to know how to
render UI, build requests, and validate data, without needing that structure hardcoded separately in the
client itself.
GET /Z_CUSTOMER_SRV/$metadata <EntityType Name="CustomerList"> <Property Name="CustomerId" Type="Edm.String"/> <Property Name="CustomerName" Type="Edm.String"/> </EntityType>
This is exactly what enables Fiori Elements' metadata-driven UI generation: since the CDS View's annotations (field labels, which fields to show in a list, which are editable) flow through into the OData service's metadata, a Fiori Elements app can render a fully functional list/detail screen automatically just by pointing at the service, without hand-coding the UI layout for each field.
More Related questions...
