SAP Fiori elements provides designs for UI patterns and predefined floorplans for common application use cases. One can use SAP Fiori elements to create SAP Fiori applications based on OData services and annotations that don't need JavaScript UI coding. The resulting app uses predefined views and controllers based on SAPUI5 that are provided centrally. This means no application-specific view instances are required. SAP Fiori elements interprets metadata and annotations of the underlying OData service and uses the corresponding views for the SAP Fiori app at startup.
-
In BAS, invoke the Command Palette (
Settings -> Command Palette) and chooseFiori: Open Application Generator. -
Choose application type
SAP Fioriand templateList Report Page.
-
Choose
Next -
In the next dialog, choose
Use a Local CAP Projectand choose your currentincidentsproject. -
Select the
IncidentsService(Java)as the OData service and chooseNext
- Select
Incidentsas the main entity,conversationsas the Navigation entity. ChooseNext
-
Enter
incidentsas the module name andIncident-Managementas the application title. -
Enter
nsas the namespace.
-
In the upcoming steps, leave the default value for all other settings.
-
Choose
Finishto generate the application. The application is now generated and in a few seconds you can see it in theappfolder of your project. It contains aincidentsand awebappfolder with aComponent.jsfile that is characteristic for an SAPUI5 app. The process is finished when the "Application Information" screen for the newly generated UI appears. -
In order to have a working UI you need to add the following content to your UI annotations in
app/incidents/annotations.cds:
annotate service.Incidents with @(
UI.LineItem : [
{
$Type : 'UI.DataField',
Value : title,
},
{
$Type : 'UI.DataField',
Label : 'urgency_code',
Value : urgency_code,
},
{
$Type : 'UI.DataField',
Label : 'status_code',
Value : status_code,
},
]
);
annotate service.Incidents with @(
UI.FieldGroup #GeneratedGroup1 : {
$Type : 'UI.FieldGroupType',
Data : [
{
$Type : 'UI.DataField',
Value : title,
},
{
$Type : 'UI.DataField',
Label : 'urgency_code',
Value : urgency_code,
},
{
$Type : 'UI.DataField',
Label : 'status_code',
Value : status_code,
},
],
},
UI.Facets : [
{
$Type : 'UI.ReferenceFacet',
ID : 'GeneratedFacet1',
Label : 'General Information',
Target : '@UI.FieldGroup#GeneratedGroup1',
},
]
);-
Browse the generated appliction. Restart the
mvn cds:watchcommand (in thesrvfolder) in case it's still running (if not just start it) and open the index page in your browser. To do so, open the Command Palette (Setting->Command Paletteand choosePorts: Preview. There, select the entry with port 8080 (the CAP Java default port). Now append/incidents/webapp/index.htmlto the URL in your browser`s address bar. -
In the application you can click the "go" button on the right hand side and load all incidents from the database. By clicking an incident from the list you can open the details view. Use the browser's
backbutton to navigate back to the list.
Proceed with the next step: Adding authorization



