Building UI is the last step in Application development and the one which is of high importance as this is where the User interaction takes place. Going back to the fundamentals of CAP to avoid complexity of the Technical activities,CAP provides out-of-the-box support for SAP Fiori Elements frontends.
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, this fields are not always the ones that are required on the UI, as we need user friendly common terminology to help the adaptability of the solution , 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 frontends, 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 the usage of i18n files for Localization of static texts, this 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 draft 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 requirements helps separating concerns and eases maintenance.