I have a CAP Service that provides a PDF file that I needed to display in a Fiori Elements frontend using the sap.m.PDFViewer. The viewer should be placed in a section on the object page after navigating from the ListReport main page.
My CAP Service has the following annotations to provide the PDF.
3. Select List Report Object Page 4. Select Connect to an OData Service as Data source and enter as URL http://localhost:4004/browse 5. Choose Books as the Main entity and texts as Navigation entity 6. Complete the mandatory information module name (e.g. bookshop) and Project folder path for storing your app. Of course, you can also fill in the optional information.
Step 3: Make changes in package.json and ui5.yaml required for using OpenUI5
- name: sap.m
- name: sap.ui.core
- name: sap.uxap
- name: themelib_sap_fiori_3
- name: fiori-tools-proxy
ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted
- path: /browse
- name: fiori-tools-appreload
Step 4: Run the V4 application
Now http://localhost:8080/index.html should be opened in your browser. “Note: Clicking on the Go button in List Report application might request user and password. Please enter user alice, no password.” Finally I got my list items.
These are my notes on the steps needed to create the data model and publish it as oData service.
Place your raw data first
Data Definition (Interface View)
Relation between different tables (e.g. currency or text table)
Projection View (Consumption View)
Configure the UI depending on your scenario. Use different projection views for different usages of the same interface view and the same physical table.
Expose the projection view (and underlying associations like currency, country…) as service
How to we want to make the service available? Defines the binding type (OData V2 / OData V4) Activate it with the “Activate” Button within the editor window. Select the Entity and hit “Preview…” to see whtat we defined in our projection view.
If you’ve done this, you are able to view the data in a generated Fiori Elements app. But if you also want to create, edit, delete data, you’ll have to add some behavior functionality.
Behavior Definition on Data Definition
Created on top of the Data Definition. Will get the same name es the Data Definition. Implementation Type: Managed Defines the operations create, delete, edit.
Behavior Implementation on Definition View
The code for the behavior… For the travel app tutorial, some logic for a generated unique key and field validation. The class inherits from cl_abap_behavior_handler.
Behavior Definition on Projection View
Created on top of the Projection View. Will get the same name es the Projection View. Defines the operations create, delete, edit.