10 KiB
Preview Reference
Comprehensive reference for previewing SAP Fiori applications during development.
Table of Contents
- Preview Overview
- NPM Scripts
- Run Control
- Mock Data
- Live Data
- App-to-App Navigation
- External FLP Preview
- Developer Variants
- SAP Horizon Theme
- Virtual Endpoints
- CAP Project Preview
Preview Overview
SAP Fiori tools provides multiple preview options:
| Method | Use Case |
|---|---|
| NPM Scripts | Quick terminal-based preview |
| Run Control | IDE-integrated launch configurations |
| Context Menu | Right-click folder quick commands |
Default Preview Port
Applications run on localhost:8080 by default. If port is in use, system selects next available port.
HTTPS/SSL Considerations
localhostserves as HTTP proxy to backend services- Domain security policies may require HTTPS
- Configure browser to trust local certificates if needed
NPM Scripts
Available Scripts
| Script | Command | Description |
|---|---|---|
| start | npm start |
Live data from backend OData service |
| start-mock | npm run start-mock |
Mock data via MockServer |
| start-local | npm run start-local |
Mock data + local SAPUI5 resources |
| start-noflp | npm run start-noflp |
Without Fiori launchpad sandbox |
Running Scripts
VS Code:
- Open terminal:
Ctrl + `` - Navigate to project root
- Run script:
npm run start-mock
SAP Business Application Studio:
- Open terminal: Terminal > New Terminal
- Navigate to project root
- Run script:
npm run start-mock
Context Menu: Right-click project folder and select from available scripts.
Run Control
Configuration Location
<workspace_root>/.vscode/launch.json
Important: Run Control only searches root-level .vscode/ folder, not subfolders.
Sample launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Start app-name",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "start"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
},
{
"name": "Start app-name (mock)",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "start-mock"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
}
]
}
Multi-Root Workspace
Multiple configurations can be merged:
- Add folders as workspace roots
- Each root's
launch.jsonconfigurations become available - Access via Run and Debug view
Creating Run Configurations
VS Code:
Fiori: Create Run Configuration (VS Code)
SAP Business Application Studio:
Fiori: Create Run Configuration (BAS)
Mock Data
MockServer Setup
Install MockServer:
Fiori: Install MockServer
Or manually:
npm install @sap-ux/ui5-middleware-fe-mockserver --save-dev
Mock Data Location
webapp/localService/mockdata/
├── EntitySet.json
├── AssociatedEntitySet.json
└── ...
Mock Data Format
[
{
"ID": "1",
"Name": "Product 1",
"Price": 100.00,
"Currency": "USD"
},
{
"ID": "2",
"Name": "Product 2",
"Price": 200.00,
"Currency": "EUR"
}
]
Data Editor
Visual mock data management tool.
Launch: Via Application Info page > Start Data Editor
Features:
- Edit cells by double-clicking (primary/foreign keys excluded)
- Add rows with automatic cascading to related entities
- Delete rows with cascading deletions
- Search functionality
- Show/hide columns
Configuration for Live Updates:
Add to ui5-mock.yaml:
server:
customMiddleware:
- name: "@sap-ux/ui5-middleware-fe-mockserver"
configuration:
watch: true
AI Mock Data Generation
Generate contextual mock data using entity property names.
Requirements:
- SAP Build Code subscription or Test Drive access
- EDMX project with
metadata.xmlfile
Launch: Via Page Editor > Generate Mock Data action
Live Data
Configuration
Live data preview connects to actual backend OData services.
Requirements:
- Backend system accessible
- Authentication configured
- Destination set up (BAS) or system connection (VS Code)
Start Command
npm start
ui5.yaml Configuration
server:
customMiddleware:
- name: fiori-tools-proxy
afterMiddleware: compression
configuration:
backend:
- path: /sap
url: [https://backend.system.com](https://backend.system.com)
destination: BACKEND_DESTINATION
App-to-App Navigation
Enable Navigation Preview
Fiori: Enable App-to-App Navigation Preview
Configuration Steps
- Execute command via Command Palette
- Select source application
- Select destination application(s)
- Launch source app preview
- Execute navigation
Generated Files
Source Application:
appconfig/fioriSandboxConfig.json- FLP sandbox configuration- Updated
ui5.yaml- Middleware configuration
fioriSandboxConfig.json Structure
{
"applications": {
"destination-app-semantic-object-action": {
"additionalInformation": "SAPUI5.Component=namespace.destination",
"applicationType": "URL",
"url": "../destination-app/",
"title": "Destination App"
}
}
}
Requirements
- Both applications in same workspace
- Configured external navigation in source app
- Matching semantic objects and actions
External FLP Preview
Purpose
Preview application within actual SAP Fiori launchpad environment.
Configuration
Fiori: Preview on External Fiori Launchpad
Parameters
| Parameter | Description |
|---|---|
| FLP URL | URL of target Fiori launchpad |
| Semantic Object | Application semantic object |
| Action | Navigation action |
Use Cases
- Test FLP-dependent features
- Verify tile configuration
- Test cross-application navigation
Developer Variants
Purpose
Create and test page variants during development.
Creating Variants
Fiori: Create Developer Variant
Variant Types
- Filter variants
- Table variants
- Page variants
Storage
Developer variants stored locally, not deployed to backend.
SAP Horizon Theme
Preview with Horizon Theme
Fiori: Preview with SAP Horizon Theme
About SAP Horizon
SAP Horizon is SAP's evolved design language with:
- Modern visual design
- Improved accessibility
- Enhanced user experience
Theme Variants
| Theme | Description |
|---|---|
| sap_horizon | Light theme |
| sap_horizon_dark | Dark theme |
| sap_horizon_hcb | High contrast black |
| sap_horizon_hcw | High contrast white |
Virtual Endpoints
Purpose
Convert project to use virtual endpoints for simplified proxy configuration.
Convert Command
Fiori: Convert to Virtual Endpoints
Benefits
- Simplified destination configuration
- Consistent endpoint naming
- Easier multi-system setup
Configuration Update
Updates ui5.yaml with virtual endpoint mappings.
CAP Project Preview
Prerequisites
- CAP project with
cdsdependencies - Node.js or Java runtime
- Database configured (SQLite for development)
Starting Preview
Node.js CAP:
cds watch
Java CAP:
mvn spring-boot:run
Fiori Preview in CAP
From CAP project root:
npm run start
Or use Run Control with CAP-specific configuration.
Supported Templates for CAP
- List Report Object Page (OData V4)
- Analytical List Page (OData V4)
CAP-Specific ui5.yaml
specVersion: "2.4"
metadata:
name: cap-app
type: application
server:
customMiddleware:
- name: fiori-tools-proxy
afterMiddleware: compression
configuration:
backend:
- path: /odata/v4
url: [http://localhost:4004](http://localhost:4004)
Custom Middlewares
Adding Custom Middleware
Create custom server middleware for specialized preview needs.
Configuration
In ui5.yaml:
server:
customMiddleware:
- name: my-custom-middleware
afterMiddleware: compression
configuration:
option1: value1
Use Cases
- Custom authentication handling
- Request/response modification
- Logging and debugging
- Feature flags
Troubleshooting
Port Already in Use
System automatically selects next available port. Check terminal output for actual port.
SSL Certificate Errors
Configure browser to trust localhost certificates or use HTTP for development.
Backend Connection Failed
- Verify destination/system configuration
- Check authentication credentials
- Confirm backend service is accessible
- Review proxy configuration in ui5.yaml
Mock Data Not Loading
- Verify MockServer is installed
- Check mock data file names match entity sets
- Validate JSON syntax in mock data files
- Ensure metadata.xml is present
Documentation Source
GitHub: https://github.com/SAP-docs/btp-fiori-tools/tree/main/docs/Previewing-an-Application
Key files:
previewing-an-application-b962685.mduse-mock-data-bda83a4.mduse-live-data-497aee2.mdgenerating-mock-data-with-ai-815c310.mdrun-control-overview-d7f20f3.mdapp-to-app-navigation-preview-543675f.mdpreview-an-application-on-external-sap-fiori-launchpad-c789692.mddeveloper-variant-creation-ceb845a.mdpreview-an-application-with-the-sap-horizon-theme-2a42256.mduse-custom-middlewares-dce5315.mdpreviewing-an-sap-fiori-elements-cap-project-1dc179a.md