Building the UI is the last step in application development and the one that is of high importance as this is where the user interaction takes place. Going back to the fundamentals of SAP Cloud Application Programming Model to avoid complexity of the technical activities, CAP provides out-of-the-box support for SAP Fiori Elements front ends.
This gives a quick start and can be further enhanced to user needs, This enhancement is achieved by certain features provided by CAP, which we will discuss in this unit.
The UI related Artifacts are developed and maintained under the app folder.
The UI generated by CAP as a quick start generally uses the metadata from the dataset. These fields are not always the ones that are required on the U because we need user friendly common terminology to help the adaptability of the solution, and this is supplemented by the translation of the static data to make the application more dynamic with no language constraints.
SAP Fiori elements apps are generic front ends, which construct and render the pages and controls based on annotated metadata documents. The annotations provide semantic annotations used to render such content, for example:
As shown in the image, we use annotations for the CatalogService Entity Products with @ UI Then define the Selection Fields and the LineItems,the ones shown in the initial output.
We have seen in the unit for Domain Modelling that the usage of i18n files for Localization of static texts is one the key elements for the enhancement. We use this as a reference as seen in the image above.
We use @odata.draft.enabled in the service file to enable drafts for an entity exposed by a service.
Annotation Placement: Although Placement of Annotations can be added to the models with no constraints, it is recommended to place them in the app folder. In our example, we have defined a new .cds file under the srv folder. Having a separate file for this requirement helps to separate concerns and eases maintenance.