Debugging
PreBilt Overview
The PreBilt front end is an SAP UI5 application framework that renders user interfaces dynamically at runtime based on configuration data from the backend. Instead of hardcoding UI elements, PreBilt uses App Master Data (AMD) - a configuration-driven approach where the backend defines:
Screen layouts and UI controls
Field mappings and data bindings
Business logic and validations
Screen buttons and actions
This architecture allows UI modifications through backend configuration changes without frontend code deployment, making the application highly flexible and maintainable.
Prerequisites
This guide assumes you have some experience with single page web applications and SAPUI5 applications. Also, a knowledge of calling JSON APIs from JavaScript would be helpful.
Debugging PreBilt applications
Debugging PreBilt applications requires understanding both the configuration-driven architecture and runtime rendering:
Key debugging considerations:
Configuration vs Code Issues
Determine if issues stem from AMD configuration or JavaScript code
Check Network tab for AMD data loading from backend services
Validate AMD JSON structure in browser console
Compare expected vs actual configuration values
Dynamic Rendering Challenges
UI elements don’t exist until runtime rendering completes
Use browser breakpoints in rendering functions – setupDetail Page or setupListPage
Common PreBilt Debugging Points
AMD Loading: Verify configuration data arrives correctly
Control Generation: Trace how configuration maps to UI5 controls
Data Binding: Ensure dynamic bindings match backend field names
Event Handlers: Confirm dynamically attached events work properly
Validation Rules: Check if backend validation logic executes correctly
Debugging Tools and Techniques
Enable UI5 debug mode:
sap-ui-debug=true
URL parameter if low level UI5 debugging is requiredUse UI5 Inspector browser extension for control hierarchy
Set breakpoints in base controller rendering methods
Configuration-Specific Issues
Missing or malformed AMD entries
Incorrect control type mappings
Invalid property assignments for UI5 controls
Broken references between configuration elements
General web debugging with browser developer tools
Browser developer tools are essential for debugging web applications. Access them by pressing F12 or right-clicking and selecting “Inspect” in most browsers. The developer tools provide several panels:
Elements/Inspector: View and modify HTML/CSS in real-time
Console: View JavaScript logs, errors, and execute commands
Network: Monitor HTTP requests and responses
Sources/Debugger: Set breakpoints and step through JavaScript code
Application/Storage: Inspect cookies, local storage, and session storage
Key debugging techniques
Use breakpoints to pause code execution at specific lines
Use
console.log()
statements to track variable valuesInspect element styles to debug CSS issues
Use the debugger statement in JavaScript to create breakpoints programmatically
Check the console for JavaScript errors
The console is your first stop when debugging JavaScript issues:
Red error messages indicate JavaScript exceptions that stopped code execution
Yellow warnings highlight potential issues that may cause problems
Stack traces show the sequence of function calls leading to an error
Common console error types
ReferenceError: Variable or function not defined
TypeError: Operation performed on wrong data type
SyntaxError: Invalid JavaScript syntax
NetworkError: Failed resource loading
Tips for console debugging
Clear the console before reproducing issues for cleaner output
Use console filters to show only errors or warnings
Click on file links in stack traces to jump directly to problematic code
Use console.trace() to log the current call stack
Check the network tab for SAP connection issues
The Network tab helps diagnose SAP backend connectivity problems:
What to look for
HTTP Status Codes:
200: Successful request
401: Authentication required
403: Authorization denied
404: Resource not found
500: Server error
Performance issues:
Look for slow requests (red timing bars)
Check for excessive number of requests
Verify response sizes aren’t too large
Server errors may indicate issues in the ABAP backend layer. It is worth checking transaction ST22 in the SAP system for these types of errors.
Understand the role of tctm_apps.js
The tctm_apps.js file serves as the application registry and configuration hub:
Key responsibilities
Defines available apps and their metadata
Maps app IDs to their respective controllers and views
Configures app-specific settings and parameters
Manages app lifecycle and initialization
Debugging tips
Check if your app is properly registered in the apps configuration
Verify app paths and namespaces are correct
Look for missing or misconfigured app properties
Use console logging to trace app initialization flow
Understand the role of tctm_core.js
The tctm_core.js file provides core functionality for the entire application:
Core features
Application initialisation and bootstrapping
Global event handling and communication
Utility functions used across apps
Debugging approaches
Set breakpoints in initialization functions to trace startup issues
Check utility function parameters and return values
Verify data models are properly initialized
Understand detail screens
Detail screens typically display information about a single entity or a selection screen.
Common patterns
Controller naming: App_XXX.controller.js
View naming: App_XXX.view.js - Data binding to a single entity
Debugging detail screens
Verify data binding paths are correct
Check if entity data is loaded before rendering
Ensure form controls are properly bound
Validate navigation parameters passed to the screen
Common issues
Missing or incorrect entity keys
Binding to non-existent properties
Timing issues with asynchronous data loading
Understand List screens
List screens display collections of data in list format.
Typical structure
Uses List controls
Implements filtering, sorting, and searching
Handles item selection and navigation
Debugging list screens
Check if collection binding path is correct
Verify filters and sorters are properly applied
Ensure aggregation binding is set up correctly
Common problems
Empty lists due to incorrect service URLs
Performance issues with large datasets
Filter criteria not properly formatted
Understand individual app architecture
Each app follows a consistent MVC pattern.
Structure:
apps/tctm_wm_app_XXX/
├── controller/
│ └── App_XXX.controller.js
├── view/
│ └── App_XXX.view.js
├── extensions/
│ └── App_XXX.extensions.js
└─── css/
└── App_XXX.css (optional)
Debugging approach
Start with the controller to understand business logic
Check view for UI element bindings
Review extensions for customizations
Key debugging points
onInit lifecycle method for initialization issues
Screen “initialise” methods
AJAX functions which communicate with SAP.
Debugging locally using live-server
Live-server enables local development and debugging:
Setup steps
Install live-server: npm install -g live-server
Navigate to project root directory
Run: live-server --port=8080
Debugging advantages
Automatic browser refresh on file changes
No cache issues during development
Easy to add console.log statements
Can modify code and see immediate results
Common issues
Ensure correct relative paths for resources or load SAPUI5 library from SAP CDN in the UI5 bootstrap section in the index.html file.
Debugging a Debug APK file via the browser
Debug APK files can be debugged using Chrome DevTools.
Prerequisites
Enable Developer Options on Android device
Enable USB Debugging
Install Chrome on development machine
Steps
Connect Android device via USB
Open Chrome and navigate to chrome://inspect
Ensure “Discover USB devices” is checked
Launch the debug APK on device 5. Click “inspect” next to your app in Chrome
Debugging features
Full access to console logs
Network request inspection
JavaScript debugging with breakpoints
Performance profiling
Local storage inspection
Tips
Use “adb logcat” for additional Android system logs
Enable “Pause on exceptions” for error debugging
Use remote debugging for WebView content
Monitor memory usage for performance issues
Common APK-specific issues
WebView compatibility problems, check the version of Chrome on the Android device
Different behavior between browser and WebView
usesPlainText permission missing from Android Manifest if plain HTTP is being used (not recommended)
Last updated
Was this helpful?