Learn SAP from the Experts | The SAP PRESS Blog

11 Key Joule Commands for Development with SAP CAP

Written by SAP PRESS | Mar 20, 2026 1:00:01 PM

A prompt is an instruction or input that triggers action. In Joule, code quality relies on clear prompts—well-crafted prompts produce precise, relevant outputs, enhancing the user experience.

 

Based on inputs from functional consultants and business users, developers can cre­ate prompts via Joule to enable app generation in SAP Build Code. The figure below demon­strates how developers interact with Joule in SAP Build Code.

 

 

In a nutshell, the business process owner defines the business requirements, and the functional consultant translates them into functional specifications. The developer then converts the specifications into prompts and enters them into SAP Build Code, where Joule, SAP’s AI copilot, automatically generates data models, service defini­tions, UI elements, business logic, and even unit test scripts.

 

Below we’ll summarize key Joule commands for development with SAP Cloud Applica­tion Programming Model, their usage, and sample prompts. It serves as a quick refer­ence for structuring prompts across tasks such as model generation, data editing, and logic implementation.

 

/cap-gen-app

This generates a full SAP Cloud Appli­cation Programming Model app (including the CDS model, sample data, logic). Supports vague or detailed prompts. Joule guides refinement.

 

Sample prompt: Create a freight management app with Shippers, Shipments, and Cargo Items. Include sample data. If shipment weight exceeds 1,000 kg, auto-set priority to High.

 

/cap-gen-model

This creates only the SAP Cloud Appli­cation Programming Model data model (entities, associations). Precision improves results.

 

Sample prompt: Define a freight model: Shipper (ID, Name, Contact) and Ship­ment (ID, Origin, Destination, Weight).

 

/cap-edit-model

This edits existing models, adds com­ments, or reviews models for best practices. Requires # to include the file you want to include.

 

Sample prompt: FreightService.cds: Replace Port with Warehouse and add a Deliv­ery Date field to Shipment.

 

/cap-gen-data

This generates sample data for models. Specifies ranges/formats for realism.

 

Sample prompt: Generate freight sample data: Set Shipment weight between 500 and 5,000 kg and Port countries to major trade hubs.

 

/cap-edit-data

This modifies existing sample data (CSV files). Context variable required.

 

Sample prompt: #shipments.csv: Update weights to metric tons (divide values by 1,000).

 

/cap-app-logic

This adds/edits app logic (e.g., validations, triggers). Breaks complex tasks into steps.

 

Sample prompt: freight-service.js: If shipment is delayed by more than 3 days, auto-send email to Shipper.

 

/cap-unit-test

This generates unit tests for logic. Provide positive/negative test cases.

 

Sample prompt: freight-service-test.js: Verify High Priority is set when weight is more than 1,000 kg (pass/fail cases).

 

/fiori-gen-spec-app

This creates an SAP Fiori elements app from business requirements (supports text/image inputs).

 

Sample prompt: Generate draft-enabled SAP Fiori app for freight tracking with list reports and object pages.

 

/add-ui

This adds SAP Fiori UI (web/mobile) to existing SAP Cloud Application Programming Model backend services.

 

Sample prompt: Create mobile UI for Shipment tracking using existing CargoService.

 

/ui5-typescript

This converts SAPUI5 projects/files to TypeScript (supports incremental migration).

 

Sample prompt: Migrate Main.controller.js to TypeScript without changing project setup.

 

/ui5-create-page

This scaffolds new SAPUI5 page with view, controller, and routing configuration.

 

Sample prompt: Create AddressForm page with navigation from Main view header button.

 

In addition to our specific prompt library for our intelligent freight order management use case, below shows key best practices for using Joule in development, offering actionable guidelines and practical examples to improve prompt engineering and code quality.

 

Category Best Practice Examples
Prompt specificity Describe entities, fields, and business rules explicitly.

Vague: Make a freight app.

Improved. Create a freight app with Shipment (ID, Weight, Priority) linked to Shipper (ID, Name, Contact). Auto-set Priority to High if Weight is more than 1,000 kg.

Data modeling Avoid technical CDS terms (e.g., "aspect," "enumeration"). Describe entities in business terms.

Avoid: Add compositions for CargoItems.

Use: Link Shipment to CargoItems via associations.

App logic Define validation rules and data flow. For updateShipmentStatus, validate Weight is more than 0 before assigning Approved status.
Unit tests Include edge cases (e.g., overweight shipments). Test calculateFreightCost with Weight=50kg (valid) and weight=-10kg (invalid).
Iterative refinement Tweak prompts based on initial outputs. Regenerate sample data: Use kg for Weight and ISO codes for Port countries.
Task decomposition Split tasks into model tasks, then logic tasks, then UI tasks.

Step 1: /cap-gen-model for Shipment/Port entries

Step 2: /ui5-create-page for tracking dashboard

Context awareness Reference files with the # character. Joule auto-detects project scope. #ShipmentService.cds: Add CustomsCleared field.

 

Editor’s note: This post has been adapted from a section of the book Developing Apps with SAP Build Code and Generative AI by Mohit Bansal, Adwait Fadnavis, Kuldeep Sharma, and Mohammed Zain Ul Abideen. Mohit is an SAP mentor with more than 18 years of expertise working with various SAP technologies with a focus on SAP BTP, AI, SAP Fiori, and SAP S/4HANA development. Adwait is a seasoned SAP professional with more than 8 years of experience specializing in SAP BTP, SAP Build Process Automation, SAP Fiori, and SAP Cloud Application Programming Model. Kuldeep is a senior technology architect at a world-leading IT services company, where he leads the SAP BTP AI and automation service offerings and center of expertise. Mohammed is a seasoned SAP developer with more than 8 years of expertise in SAPUI5, SAP Fiori, and SAP BTP solutions.

 

This post was originally published 3/2026.